SAP Cloud Platform Open Connectors

POST /accounts/.../definitions

POST /accounts/objects/definitions

POST /accounts/{id}/objects/definitions

Create a new common resource with fields only at the account level. You can either create a common resource for the account associated with the credentials that you pass with the request, or you you can specify an account Id. The endpoints to create a common resource for an account are:

  • POST /accounts/objects/definitions
    • Create a common resource for the account associated with the logged in user or the Organization and User Secret passed with the request.
  • POST /accounts/{id}/objects/definitions
    • Create a common resource for the account by passing the account id with the request.

Note: These endpoints will delete only the account level fields in common resources with fields at multiple levels. All organization level fields remain and the common resource is not deleted. If the common resource has only account level fields, then the resource is also deleted.

Path Parameters

Only used for POST /accounts/{id}/objects/definitions.

id
The unique identifier for an account within an organization.

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

POST /accounts/objects/definitions Example Request

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

POST /accounts/{id}/objects/definitions Example Request

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

Example Response

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