Annotating REST API Requests

In CCOM v1.4, you must use the custom OSvC-CREST-Application-Context HTTP header to add comments to REST API requests.

The Application Context data is written to the papi_meters table.

Note:

The maximum length of the text is 40 characters. If you use more than 40 characters, a Bad-Request error occurs.

Valid Request Example

This example requests the data for the account with ID 2, and it has a valid Application Context header:

https://mysite.example.com/services/rest/connect/v1.4/accounts/2

The following table lists a valid Application Context header:

Header Value

OSvC-CREST-Application-Context

This is a valid request for account 2.

Response to Valid Request Example

{
  "id": 2,
  "lookupName": "George Hewitt",
  "accountHierarchy": {
...

Invalid Request Example

This example requests the data for the account with ID 2, but it has an invalid Application Context header:

https://mysite.example.com/services/rest/connect/v1.4/accounts/2

The following table lists an invalid Application Context header:

Header Value

OSvC-CREST-Application-Context

This request for account 2 has too many characters.

Response to Invalid Request Example

{
  "type": "https://mysite.example.com/services/rest/connect/exceptions/OSC-CREST-00025",
  "title": "Bad Request",
  "status": 400,
  "detail": "Invalid Request: ApplicationContext maximum length exceeded; value 51 > 40;
    OSvC-CREST-Application-Context header",
  "instance": "https://mysite.example.com/services/rest/connect/v1.4/accounts/2",
  "o:errorCode": "OSC-CREST-00025"
}