SAP Open Connectors

Account Level Common Objects APIs

GET /accounts/.../definitions

GET /accounts/objects/definitions

GET /accounts/{id}/objects/definitions

Retrieve a list of common object and their account level fields. You can either list the fields based on the credentials that you pass with the request, or you you can specify an account Id. The endpoints to retrieve the common object fields by account are:

  • GET /accounts/objects/definitions
    • Retrieve a list of common object based on the account associated with the logged in user or the Organization and User Secret passed with the request
  • GET/accounts/{id}/objects/definitions
    • Retrieve a list of common object within an account by passing the account id with the request.

Path Parameters

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

id
The unique identifier for an account within an organization.

Response Fields

objectName
The name of the new common object.
fields
An object containing the field names and data types of the common object.
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.

GET /accounts/objects/definitions Example Request

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

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

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

Example Response

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


GET /accounts/.../{objectName}/definitions

GET /accounts/objects/{objectName}/definitions

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

Retrieve account-level fields in a specific common object in an account. You can either retrieve a common object that is in your account based on the credentials that you pass with the request, or you you can specify an account Id. The endpoints to retrieve common object fields by account are:

  • GET /accounts/objects/{objectName}/definitions
    • Retrieve a specific common object based on the account associated with the logged in user or the Organization and User Secret passed with the request.
  • GET/accounts/{id}/objects/{objectName}/definitions
    • Retrieve a specific common object within an account by passing the account id with the request.

Path Parameters

id
The unique identifier for an account within an organization.
Only used for GET/accounts/{id}/objects/{objectName}/definitions.
objectNameThe name of the common object.

Response Fields

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

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

curl -X GET \
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' \

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

curl -X GET \
https://api.openconnectors.us2.ext.hana.ondemand.com/elements/api-v2/accounts/156162/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": "account"
}

POST /accounts/.../definitions

POST /accounts/objects/definitions

POST /accounts/{id}/objects/definitions

Create a new common object with fields only at the account level. You can either create a common object 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 object for an account are:

  • POST /accounts/objects/definitions
    • Create a common object 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 object 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 object is not deleted. If the common object 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 object.
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"
 }
}

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

POST /accounts/objects/{objectName}/definitions

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

Create a new common object in a specific account by specifying the name of the resource in the path. You can either create a common object 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 object for an account are:

  • POST /accounts/objects/{objectName}/definitions
    • Add fields to a common object 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 object 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 object.

Request Body Parameters

objectName
The name of the common object.
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"
  }
}

PUT /accounts/.../{objectName}/definitions

PUT /accounts/objects/{objectName}/definitions

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

Replace account level fields in a common object. Replacing fields removes existing fields, so include existing fields in the request body parameters along with new fields . You can either replace fields in a common object for the account associated with the credentials that you pass with the request, or you you can specify an account Id. The endpoints to add fields to a common object for an account are:

  • PUT /accounts/objects/{objectName}/definitions
    • Replace fields in a common object for the account associated with the logged in user or the Organization and User Secret passed with the request.
  • PUT /accounts/{id}/objects/{objectName}/definitions
    • Replace fields in a common object 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 PUT /accounts/{id}/objects/{objectName}/definitions.
objectName
The name of the common object.

Request Body Parameters

fields

An object containing the field names and data types of the common object.
path

The name of the field.
type

The data type of the field.

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

curl -X PUT \
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": "Last_Name",
      "type": "string"
    }
  ]
}
'

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

curl -X PUT \
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": "Last_Name",
      "type": "string"
    }
  ]
}
'

Example Response

{
  "myResource": {
    "fields": [
      {
        "type": "string",
        "path": "First_Name"
      }
    ],
    "level": "account"
  }
}

DELETE /accounts/.../definitions

DELETE /accounts/objects/definitions

DELETE /accounts/{id}/objects/definitions

Delete all account-level fields in a common objects and all resources with fields only at the account level of the account associated with the request. You can either delete a common object 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 object for an account are:

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

Path Parameters

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

id
The unique identifier for an account within an organization.

DELETE /accounts/objects/definitions Example Request

curl -X DELETE \
  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' \

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

curl -X DELETE \
  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' \

Example Response

A response with a 200 Status Code indicates success. You can confirm that you deleted the common object with GET accounts/objects/definitions or GET/accounts/{id}/objects/definitions

DELETE /accounts/objects/{objectName}/definitions

DELETE /accounts/objects/{objectName}/definitions

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

Delete all account-level fields in a specific common object, and the common object itself if it contains only fields at the account level of the account associated with the request. You can either delete common resources from the account associated with the credentials that you pass with the request, or you you can specify an account Id. The endpoints to delete specific common resources from an account are:

  • DELETE /accounts/objects/{objectName}/definitions
    • Replace fields in a common object for the account associated with the logged in user or the Organization and User Secret passed with the request.
  • DELETE /accounts/{id}/objects/{objectName}/definitions
    • Replace fields in a common object 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 PUT /accounts/{id}/objects/{objectName}/definitions.
objectName
The name of the common object.

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

curl -X DELETE \
  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' \

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

curl -X DELETE \
  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' \

Example Response

A response with a 200 Status Code indicates success. You can confirm that you deleted the common object with GET accounts/objects/definitions or GET/accounts/{id}/objects/definitions

PATCH /accounts/objects/{{objectName}}

PATCH /accounts/objects/{{objectName}}

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

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

Path Parameters

objectNameThe name of the common object.

Header Parameters

Request Body Parameters

objectNameThe new name of the common object.

Example Request

curl -X PATCH \
  'https://api.openconnectors.us2.ext.hana.ondemand.com/elements/api-v2/accounts/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":"account"
}