Agents WebAPI
The Agents API contains everything in the normal web service API but does not attempt to model entities. It exposes the latest Services agents and functions. All operations are accessed using HTTP POST.
To get the version and more info, access the API endpoint: /api
Note
The agents do not return HTTP errors - a failed call will return NULL instead.
Examples:
POST /api/v1/Agents/Contact/GetContact?contactId=123
Returns a JSON object representing Contact 123.
POST /api/v1/Agents/List/SaveListItemEntity
Adds a new list item to the Category list (assuming the list item entity parameter has been properly initialized).
GET vs. POST
GET /api/v1/Agents/Appointment/CalculateDays
GET this to get a description of the call. The method is not invoked using GET, even if the method is called GetAppointment. To actually invoke the method, you need to POST to the endpoint:
POST /api/v1/Agents/Appointment/CalculateDays
{ "Contact": { "ContactId": 123 },
"AppointmentId": 1234,
"Description": "string",
"StartDate": "2021-06-06T13:02:55Z",
"EndDate": "2021-06-06T13:02:55Z"
}
This method takes an appointment entity as its parameter so this needs to be in the POST body. The result of the service call is returned as JSON or XML, depending on the Accept header.
Errors
Errors are returned as a NULLs. You may also get a 200 OK with an internal error object.
Note
Check the response object, not just the HTTP status code.
HTTP 400 Bad Request - with an error result:
POST api/v1/Agents/Contact/GetContactEntity?contactEntityId=glops
Happens when the request is malformed.
HTTP 200 OK - with a NULL result:
POST api/v1/Agents/Contact/GetContactEntity?contactEntityId=9999
Happens when the request succeeds but there is nothing to return.
200 OK with an internal error object:
{
"Message": "The request is invalid.",
"MessageDetail": "The parameters dictionary contains a null entry for parameter 'contactEntityId'."
}
Happens when the request succeeds but the data is invalid. For example, a required parameter is missing.
How to
Note
The examples below are given using JavaScripty pseudocode.