REST verbs

REST verbs

For convenience, all the API call examples in Synergist API documentation can be pasted into a browser as a URL (with some adjustments re: passwords and the server IP address). This URL pattern is only applicable to GET.

However, when using the API in your JavaScript/App code you are likely to wish to use the PUT or POST verbs. With PUT and POST, the same set of parameters (e.g. company=, action=, input= etc) have to be placed into the HTTP request body rather than the URL. It is important to use POST for updating data because URLs have a technical limit in length, so including entire record(s) in the URL isn't recommended. It is also not particularly intuitive to think of GET as creating or updating data.

DELETE

Synergist API does not use/interpret the DELETE verb, but rather you should use the parameter "action=delete" as part of a GET, PUT or POST.

Example of using a POST verb in JavaScript

NOTE: API expects HTTP Form Data and not JSON as the input.

URL: /jsonapi/calendar.json

Verb: POST
From Data / Body (including username / password):

"version": "3.7",
"action": "update",
"user": "",
"password": "",
"input": {
"data": [
{
"calDiaryInternal": "211231",
"calIsoDateTimeStart": "2020-07-14T11:00:00",
"calNumberOfDays": "1",
"calDurationDecimalHours": "4.25",
"calAllDay": "false",
"calResourceId": "268"
}
]
}

As a curl

curl --location --request POST 'https:///jsonapi/calendar.json'
--form 'version=3.7'
--form 'action=create'
--form 'user=username'
--form 'password=password'
--form 'input={"data": [{"calDiaryInternal": "211231","calIsoDateTimeStart": "2020-07-14T11:00:00","calNumberOfDays": "1","calDurationDecimalHours": "4.25","calAllDay": "false","calResourceId": "268"}]}'