API caching

For server-side caching, the API uses a validity model. In the validity model, the server sends the “Last-Modified” date to the client along with the data, and the client caches the “Last-Modified” date along with the response. When you make a second request to the same resource, you must send the saved date in the “IF-Modified-Since“ header. The server uses this date to check if the resource you are requesting has changed since the last time it was accessed (remember, the server is the only reliable source). If the resource did change, then it will send the last copy of the data along with the http code 200. Otherwise, it will send the http code 304 Not Modified. The cache validity model requires additional effort from the developer when developing the client side - if you received “Last-Modified” with a resource, send it in the “IF-Modified-Since“ header field in subsequent requests.

Example GET request-response without If-Modified-Since

GET http://servername:port/api/v1/Bss/customers.json?lang=uk&pageIndex=0&pageSize=1000&filter=%7Babn_LastName%3A%27%25NATEC%25%27%7D

accept: application/json
system: 300
global_unique_id: 6d07332c-2e63-4d49-91d2-ee01e600f7ff
Authorization: Basic YXBjdhst6XI6V2lkZWf6NvdXAx
Content-Type: application/json
Host: servername:port
Content-Length: 0

HTTP 200 response example HTTP/1.1 200 OK
Content-Length: 78597
Content-Type: aplication/json
Last-Modified: Tue, 22 Sep 2020 09:21:24 GMT
Server: Microsoft-IIS/10.0
cache-scenario: scenario.1
X-Powered-By: ASP.NET
Date: Sun, 27 Sep 2020 11:18:51 GMT
{ "data":[ { "abn_Balance":0.000000,
"abn_CreateDate":"2019-10-31T17:58:35.697",
"abn_Date":"2019-11-01T00:00:00",
"abn_Employe_Export_ID":"",
"abn_Employee_ID":"",
"abn_ExternalID":8836891,
"abn_FirstName":"",
"abn_Guid":"b75d56c7-1b84-4571-8e6c-09a3aeffc0a1",
"abn_HasNotEmptyPrepaid":0,
"abn_ID":165,
"abn_ID_Boss":164,
"abn_IsExistAD":0,
"abn_IsGuest":0,
"abn_LastName":"NATEC LLC.",
"abn_Login":"",
"abn_MiddleName":"",
"abn_ModifiedBy":"ModifiedBy",
"abn_ModifiedDate":"2019-10-31T17:58:35.75",
"abn_ModifiedFrom":"host",
"abn_NestedSets_Left":398155,
"abn_NestedSets_Right":398156,
"abn_Password":"09B0B566-2570-4447-BDF5-5304813834B8",
"abn_PositionCode":"",
"abn_ShowPhoneDirectory":0,
"abn_WorkPlace":"1234567890",
"abonentFullName":"NATEC LLC.",
"acnt_ID":86,
"acnt_ID_count":1,
"acnt_IsPersonal":0,
"acnt_Number":"0123456789",
"acnt_Number_Personal":"",
"actp_ID":21,
"actpd_Name":"ГКО",
"actpd_Name_Personal":"",
"aut_ID_count":0,
"aut_NameAuthCode":"",
"aut_NumberAts":0,
"bossFullName":"NATEC LLC.{1234567890}",
"cntr_ID_count":0,
"cntr_Name":"",
"com_Id":1,
"dep_ID":202,
"ext_ExtNum":"",
"ext_ID_count":0,
"grp_ID":100,
"grp_Name":"ByDefault",
"isEditAllow":1,
"isEditWorkPlace":0,
"lng_ID":1,
"loc_Name":"Brach 0001",
"location_ID":7,
"ntw_ID":1000,
"pbx_networkName":"United",
"profileType":2,
"rptURL":"",
"subsCount":0,
"tnst_ExternalID":2,
"tnst_ID":10,
"tnt_AccountMandatory":1,
"tnt_ID":130,
"total":52,
"treeNodeType":"Customer",
"trf_ID":2 } ] }

GET request-response example with an If-Modified-Since indication

GET http://servername:port/api/v1/Bss/customers.json?lang=uk&pageIndex=0&pageSize=1000&filter=%7Babn_LastName%3A%27%25NATEC%25%27%7D

accept: application/json
system: 300
global_unique_id: 6d07332c-2e63-4d49-91d2-ee01e600f7ff
Authorization: Basic YXBjdhst6XI6V2lkZWf6NvdXAx
Content-Type: application/json
Host: servername:port
Content-Length: 0
if-modified-since: Tue, 22 Sep 2020 09:21:24 GMT

HTTP 304 response example
HTTP/1.1 304 Not Modified
Last-Modified: Tue, 22 Sep 2020 09:21:24 GMT
Server: Microsoft-IIS/10.0
cache-scenario: scenario.3
X-Powered-By: ASP.NET
Date: Sun, 27 Sep 2020 13:42:36 GMT