SAP Cloud Platform Open Connectors

List Organization Level Common Resources

GET /organizations/objects/definitions

Retrieve a list of organization level common resources. 

Response Fields

systemOnlyBoolean. true indicates a prebuilt template.

Response Fields

objectName
The name of the new common resource.
fields
An object containing the field names and data types of the common resource.
path
The name of the field.
type
The data type of the field.
level
The level at which the mapping exists, either organization, account, or instance.

Example Request

curl -X GET \
  https://api.openconnectors.us2.ext.hana.ondemand.com/elements/api-v2/organizations/objects/definitions \ 
  -H 'authorization: User sAfK7LJGNz5ZHcNrvdJvLI=f03WbTbH6aRKc0HJ3oOIi, Organization 58168435e3b9959a929eb04b6218b9a2' \
  -H 'Accept: application/json' \

Example Response

{
    "myListContacts": {
    "fields": [
      {
        "type": "string",
        "path": "email"
      }
    ],
    "level": "organization"
  },
  "myContacts": {
    "fields": [
      {
        "type": "string",
        "path": "mobile"
      },
      {
        "type": "string",
        "path": "fax"
      }
    ],
    "level": "organization"
  }
}

Retrieve a Specific Organization Resource

GET /organizations/objects/{objectName}/definitions

Retrieve a specific organization level common resource.

Path Parameters

objectNameThe name of the common resource.

Response Fields

fields
An object containing the field names and data types of the common resource.
path
The name of the field.
type
The data type of the field.

Example Request

curl -X GET \
  https://api.openconnectors.us2.ext.hana.ondemand.com/elements/api-v2/organizations/objects/myResource/definitions \ 
  -H 'authorization: User sAfK7LJGNz5ZHcNrvdJvLI=f03WbTbH6aRKc0HJ3oOIi, Organization 58168435e3b9959a929eb04b6218b9a2' \
  -H 'Content-Type: application/json' \

Example Response

{
  "fields": [
      {
        "type": "string",
        "path": "mobile"
      },
      {
        "type": "string",
        "path": "fax"
      }
    ],
  "level": "organization"
}

Create a New Organization Resource

POST /organizations/objects/definitions

Create a new common resource. As an organization user, you can create fields at the organization and account level. 

Request Body Parameters

objectName
The name of the common resource.
Required
fields
An object containing the field names and data types of the resource.
Required
path
The name of the field.
Required
type
The data type of the field.
Required
levelThe level at which the field exists, either organization, account, or instance. Organization users can create fields at any level, account users can create fields only at the accountor instance level.
Optional

Example Request

curl -X POST \
	
  https://api.openconnectors.us2.ext.hana.ondemand.com/elements/api-v2/organizations/objects/definitions \
  -H 'authorization: User sAfK7LJGNz5ZHcNrvdJvLI=f03WbTbH6aRKc0HJ3oOIi, Organization 58168435e3b9959a929eb04b6218b9a2' \
  -H 'Content-Type:application/json' \
  -d '{  
  "myResource":{  
    "fields":[  
      {  
        "path":"firstName",
        "type":"string"
      },
      {  
        "path":"lastName",
        "type":"string"
      }
    ],
    "level":"organization"
  }
}'

Example Response

{
  "myResource": {
    "fields": [
      {
        "path": "firstName",
        "type": "string"
      },
      { 
        "path": "lastName",
        "type": "string"
    ],
    "level": "organization"
 }
}

POST /organizations/objects/{objectName}/definitions

POST /organizations/objects/{objectName}/definitions

Create a single new common resource by passing the name as a path parameter. 

Path Parameters

objectName
The name of the common resource.

Request Body Parameters

objectName
The name of the common resource.
Required
fields
An object containing the field names and data types of the resource.
Required
path
The name of the field.
Required
type
The data type of the field.
Required
levelThe level at which the field exists, either organization, account, or instance. Organization users can create fields at any level, account users can create fields only at the accountor instance level.
Optional

Example Request

curl -X POST \
  https://api.openconnectors.us2.ext.hana.ondemand.com/elements/api-v2/organizations/objects/myResource2/definitions \
  -H 'authorization: User sAfK7LJGNz5ZHcNrvdJvLI=f03WbTbH6aRKc0HJ3oOIi, Organization 58168435e3b9959a929eb04b6218b9a2' \
  -H 'content-type: application/json' \
  -d '{
  "fields": [
    {
      "path": "address",
      "type": "string"
    }
  ]
}
'

Example Response

{
  "myResource": {
    "fields": [
      {
        "type": "string",
        "path": "address"
      }
    ],
    "level": "organization"
  }
}

Replace Fields in a Specific Organization Resource

PUT /organizations/objects/{objectName}/definitions

Replace fields in a common resource. Replacing fields removes existing fields, so include existing fields in the request body parameters along with new fields.

Path Parameters

objectName
The name of the common resource.

Request Body Parameters

fields
An object containing the field names and data types of the common resource.
path
The name of the field.
type
The data type of the field.

Example Request

curl -X PUT \
  https://api.openconnectors.us2.ext.hana.ondemand.com/elements/api-v2/organizations/objects/myResource/definitions \
  -H 'authorization: User sAfK7LJGNz5ZHcNrvdJvLI=f03WbTbH6aRKc0HJ3oOIi, Organization 58168435e3b9959a929eb04b6218b9a2' \
  -H 'content-type: application/json' \
  -d '{
   "fields": [
    {
      "path": "Last_Name",
      "type": "string"
    }
  ]
}
'

Example Response

{
  "myResource": {
    "fields": [
      {
        "type": "string",
        "path": "last_Name"
      }
    ],
    "level": "organization"
  }
}

Delete all Resources in an Organization

DELETE /organizations/objects/definitions

Delete all common resources in the organization. 

Example Request

curl -X DELETE \
  https://api.openconnectors.us2.ext.hana.ondemand.com/elements/api-v2/organizations/objects/definitions \
  -H 'authorization: User sAfK7LJGNz5ZHcNrvdJvLI=f03WbTbH6aRKc0HJ3oOIi, Organization 58168435e3b9959a929eb04b6218b9a2' \
  -H 'content-type: application/json' \

Example Response

A response with a 200 Status Code indicates success. You can confirm that you deleted the common resources with GET organizations/objects/definitions

Delete a Specific Organization Resource

DELETE /organizations/objects//{objectName}definitions

Delete a specific common resource . 

Path Parameters

objectName
The name of the common resource.

Example Request

curl -X DELETE \
  https://api.openconnectors.us2.ext.hana.ondemand.com/elements/api-v2/organizations/objects/myResource/definitions \
  -H 'authorization: User sAfK7LJGNz5ZHcNrvdJvLI=f03WbTbH6aRKc0HJ3oOIi, Organization 58168435e3b9959a929eb04b6218b9a2' \
  -H 'content-type: application/json' \

Example Response

A response with a 200 Status Code indicates success. You can confirm that you deleted the common resource with GET organizations/objects/definitions

Change the Name of an Organization Resource

PATCH /organizations/objects/{{objectName}}

Change the name of a common resource at the organization level by passing a new objectName in the request body.  

If the common resource includes account or instance level fields, those are not changed by this request. This essentially splits the common resource where the renamed resource includes only the organization-level fields while the previous name includes only account or instance-level fields. Use PATCH /accounts/objects/{{objectName}} and PATCH /instances/objects/{{objectName}} to change the name of the common resource associated with the account and instance level fields.

Path Parameters

objectNameThe name of the common resource.

Header Parameters

Request Body Parameters

objectNameThe new name of the common resource.

Example Request

curl -X PATCH \
  'https://api.openconnectors.us2.ext.hana.ondemand.com/elements/api-v2/organizations/objects/{{objectName}}' \
  -H 'Accept: application/json' \
  -H 'authorization: User sAfK7LJGNz5ZHcNrvdJvLI=f03WbTbH6aRKc0HJ3oOIi, Organization 58168435e3b9959a929eb04b6218b9a2' \ \
  -d '{
"objectName" : "newObjectName"
}'

Example Response

{  
  "id":69496,
  "objectName":"newObjectName",
  "fields":[  
    {  
      "type":"string",
      "path":"firstName"
    },
    {  
      "type":"string",
      "path":"lastName"
    }
  ],
  "level":"organization"
}