Retrieve updates about your SafetyCulture data
Once you have extracted all of the historical data, the next obvious step is to retrieve the modified inspections so that you can continue populating your own systems with new inspection data. This function is also useful for producing regular updates from your inspection data, such as a live dashboard.
We recommend that you use webhooks and subscribe to specific events. Alternatively, you can use polling against the following endpoint:
curl "https://api.safetyculture.io/audits/search?field=audit_id&field=modified_at&modified_after=2015-03-24T06:31:47.203Z" \
-H "Authorization: Bearer {api_token}"
To do this, you will search for inspections that are either after the last inspection that you have, or the last time you attempted to retrieve new inspections, using the modified_after
parameter.
{
"count": 1,
"total": 1,
"audits": [
{
"audit_id": "audit_853C17E6040B43DA1DFDDD8E6A4D6D3A",
"modified_at": "2015-03-24T06:31:47.203Z"
}
]
}
This will retrieve only the inspections modified since you last retrieved data, and often may contain no inspections at all depending on the frequency of updates and the frequency data is retrieved. With this information, you may then follow the steps from the previous use case to retrieve the inspection content and media.
Note that the inspections retrieved in this request may return identifiers that you have previously retrieved if the inspection it points to has been modified. You should ensure that this overwrites any inspection data that exists in your own system rather than duplicating them.