Introduction
This article describes two methods of receiving new data only from the Perfect Gym API:
- Polling.
- Webhooks.
This article will be helpful to every API user working with the Perfect Gym applications.
Polling
This is making requests to an endpoint repeatedly. To do it efficiently, which means to get only new or updated records, use the Filter on the Version property in a query.
- For a given endpoint, the Version property may be considered as a data set timestamp.
- New or updated data records get the new highest value in the Version property.
- To get the new data, query for all the records with a greater Version value than the previous one.
Example
If you got the data from odata/Clubs and the maximum Version value within data records you got is Y.
The new data of Clubs you can get with the query: /odata/Clubs?$filter=version gt Y
Webhooks
This is creating a subscription to a desired Event in the system to get notifications and data related to that Event.