We enable partners to have their classes booked by our users. Usually, in order to register classes and update their schedule when a user books a class, a partner has to access our Partners’ Portal. But with Booking API it’s possible to add classes’ schedules on Gympass app and website, enabling users to book such classes directly from there, updating the partner’s own schedule automatically.
The regular flow is:
With our Booking API, you can leverage a seamless flow integrating your class system with ours, allowing an easier and integrated process for booking:
It allows an easier and integrated process:
Available at this Postman documentation.
You will need a Client ID and Client Secret provided by Gympass. With these two parameters you can generate your Bearer Token with the curl below (production environment):
request token1curl -X POST https://identity.gympass.com/auth/realms/master/protocol/openid-connect/token \2-H 'Content-Type: application/x-www-form-urlencoded' \3-d 'grant_type=client_credentials&client_id=your-client-id&client_secret=your-client-secret'
- The token needs to be sent on all requests;
- The token might expire. Currently, it has a long expiration time, but Gympass can revoke it at any time due to security reasons. So, the recommended implementation is to follow oauth2 pattern (https://www.oauth.com), which is:
- Before each request to the API the partner should request a new token or
- Before each request to the API the partner might refresh the token (https://www.oauth.com/oauth2-servers/access-tokens/refreshing-access-tokens) or
- Only ask for a new token or refresh token after receiving a HTTP 403 (forbidden)
Once you create classes on your system, Gympass receives the information via Booking API, doing all the work only once and maintaining the information synchronized between applications.
The Gympass webhooks will notify you when specific events are triggered. These notifications are HTTP POST requests to your registered URL. When a Gympass user books a class or cancels the booking, we emit an event to the registered webhook. If it is a booking request, you should have 15 minutes to send a PATCH with the desired booking status, otherwise, the request will be automatically rejected.