Record versioning - getting latest version of the record
Record numbers - getting latest version of the record
In this example the API consumer wishes to ensure that the record being updated has not been changed by another process prior to a new update being made.
Example from update activity Activities API
Get the current state of the record you wish to update:
http://<SERVER>jsonapi/activities.json?company=1&version=3.9&user=user&password=user&style=modeldata&modelstructure=activitydetails&Activityid=Activityid=7957
Response:
(activityRecordVersionNumber=64)
{
"responsecode": 1,
"responsestatus": "OK",
"errorcode": 0,
"errormessage": "",
"totalrows": 1,
"totalpages": 1,
"responsemessage": "",
"pagerows": 0,
"pagenumber": 1,
"success": true,
"data": [
{
"activityuuid": "E0C7A305F779704BBB58F9FC01E02DB5",
"activityTimeStampModified": 1544451501,
"activityRecordVersionNumber": 64,
"activityAlertBeforePeriodDescription": "",
etc.etc..
}
]
}
Record version number
activityRecordVersionNumber: This number is returned by the API when first creating/loading/amending a record. It must be passed back when doing an update if you wish to ensure the record has not changed since it was last read by the API. If the record has been updated by another user in the meantime, the update will fail.
Example request:
http://<SERVER>/jsonapi/activities.json?company=1&user=user&password=user&version=3.9&action=update&input={
"data": [
{
"activityID": 7957,
"activityDetails": "Meeting at Boundry Mill",
"activityCustomField300": "MyText",
"activityRecordVersionNumber": 64
}
]
}
Response:
{
"responsecode": 1,
"responsestatus": "OK",
"errorcode": 0,
"errormessage": "",
"responsemessage": "data processed successfully.",
"warningmessage": "",
"success": true,
"data": [
{
"activityID": 7957,
"activityuuid": "E0C7A305F779704BBB58F9FC01E02DB5",
"activityTimeStampModified": 1544452467,
"activityRecordVersionNumber": 65
}
]
}