Skip to content

Data Caching

The Call Log and List Messages API calls will usually return the same data on each call, along with any new calls or messages that have been received. As such, each of these provides a parameter that allows an application to retrieve only new records by specifying the ID of the most recently retrieved record. This allows applications to use the API more efficiently, by caching the data locally instead of continually requesting the same data.

However, there are cases where the locally cached data may need to be discarded. The user specifies settings in the AVANSER portal that determine what data is returned by the API. These settings include which client to view data for, as well as any filters to apply to call log data.

The results of the Call Log and List Messages API calls each include an options key that indicates whether locally cached data should be discarded. If no data needs to be discarded, the value of this key will be null or an empty array. However, when the user updates their API settings, causing the data that is returned by the API to change, this key will contain an object in the following format:

{"flush_calls": true, "flush_messages": true}

If the flush_calls key exists in this object, cached call log data should be discarded. Similarly, if the flush_messages key exists in this object, cached messages should be discarded.

Note: These flags will continue to be returned in all API results until the application makes an API call to disable them, as outlined below:

Operations

Disable Cache Flags

Request

When an application discards locally cached data as a result of receiving a flush_calls or flush_messages flag in an API result, it should call this method to inform the API to stop returning the corresponding flag in future API results.

Security
accessToken
Query
optionsobject, non-emptyrequired

The flag to disable. Note: Multiple flags can be disabled in a single call by passing this parameter multiple times, eg. options[flush_calls]=false&options[flush_messages]=false

curl -i -X GET \
  'https://p3.avanser.com/app/options?options=%7B%22flush_calls%22%3Afalse%2C%22flush_messages%22%3Afalse%7D&token=YOUR_API_KEY_HERE'

Responses

Cache flags disabled.

Bodyapplication/json
timestampintegerrequired

The time that the API response left the server, represented as the number of seconds since the UNIX epoch.

Example:1508903167
exectionnumber

The number of seconds that it took to process the API request.

Example:0.00041531896591187
errorbooleanrequired

Boolean indicating whether there was an error returned by the API request.

Example:false
datastringrequired

The data returned by the API. The format varies depending on the API function that was called.

Response
{ "timestamp": 1510101397, "exection": 0.00035298299789429, "error": false, "data": "OK" }