Checking for new Data¶
All published data downloaded from the API has version information. If the published data changes, then the version is incremented.
It is possible to save time by just fetching this version information first and then deciding if the server has a more up to date version available compared to the data previously downloaded.
Use the same API Endpoints used for fetching data but send a HEAD request instead of a GET request. Although the GET request also contains version information, the HEAD request is much faster.
Create a new HEAD request as follows:
Replace with your Access Token (See Authenticating with the API)
Make sure the Authorization token is in the Header of the request and that the Body of the request is empty.
Click Send to fetch your data.
The Smart API will return the requested headers containing the Data and Software versions:
Data Version is the current version number of the published data that is currently available. Use this to compare to the version already downloaded to determine if a GET request is required to fetch the latest data.
You have already downloaded version 166 of the submissions data. You do a HEAD request and find that version 167 is available and so decide to do a GET request to get version 167 and then cache it locally, replacing your version 166.
Software Version is the current version of the API Software that is in use. This is used to determine the structure of the JSON data. The Software Version rarely changes but if it does change then the supplied JSON is likely to have a changed structure and you may need to update your client.