SAP Cloud Platform Open Connectors

POST /accounts/.../{objectName}/definitions

POST /accounts/objects/{objectName}/definitions

POST /accounts/{id}/objects/{objectName}/definitions

Create a new common resource in a specific account by specifying the name of the resource in the path. 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/{objectName}/definitions
    • Add fields to 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/{objectName}/definitions
    • Add fields to a common resource for the account by passing the account id with the request.

Path Parameters

id
The unique identifier for an account within an organization.
Only used for POST /accounts/{id}/objects/{objectName}/definitions.
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

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

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

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

curl -X POST \
  https://api.openconnectors.us2.ext.hana.ondemand.com/elements/api-v2/accounts/12345/objects/myResource/definitions \
  -H 'authorization: User sAfK7LJGNz5ZHcNrvdJvLI=f03WbTbH6aRKc0HJ3oOIi, Organization 58168435e3b9959a929eb04b6218b9a2' \
  -H 'content-type: application/json' \
  -d '{
  "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"
  }
}