Endpoints
POST - Access validate
This endpoint validates the entry of users at a gym and consequently generates transactions to pay them later.
https://api.partners.gympass.com/access/v1/validate
Request
Example1curl -X POST https://api.partners.gympass.com/access/v1/validate \2 -H 'Content-Type: application/json' \3 -H 'Authorization: Bearer {{Wellhub BEARER Token}}' \4 -H 'X-Gym-Id: ${GYM_ID}' \5 -d '{ "gympass_id": "XXXXXXXXXXXXX", "custom_code": "XXXXXXXXXXXXX" }'
Params
Field | Description |
---|---|
gympass_id | Required field. String, This is the user’s gympass_id with 13 digits, and the "value/option" will require previous check-in at the gym. |
custom_code | Optional field. String, This is the custom code that the CMS wishes to use by this user to check-in at this gym. If sent, the code will be upserted and associated with the wellhub_id (Gympass ID) and gym_id. The code is upserted when the check-in is expired, cancelled or already validated, and it is not upserted when the check-in is not found or an expected error occurs. It cannot be blank, and its maximum size is 13 chars. |
Headers
Field | Description |
---|---|
X-Gym-Id | Required field |
This is the ID of the gym you’re setting up. Choose it according to the list of gyms you manage. | |
Content-Type | Required field |
The Content-Type entity-header is used to indicate the media type of the resource. Use always application/json | |
Authorization | Required field |
The key is a string that is generated for you and identifies you and the gyms you are allowed to validate products for. To request yours please contact Wellhub Technical Sales. |
Response
Example1{2 "metadata": {3 "total": 1,4 "errors": 05 },6 "results": {7 "user": {8 "gympass_id": "XXXXXXXXXXXXX"9},10"gym": {11 "Id": XXX,12 "product": {13 "Id": XXX,14 "description": "XXXXXXX"15 }16},17"validated_at": "2020-02-19T18:00:53Z"18 }19}
Response Body
Field | Description |
---|---|
User: { “gympass_id”: “XXXXXXXXXXXXX” } | This is the Wellhub User id. You may use it to synchronize users that validated check-ins with your user base. |
Gym: { “Id”: XXX } | This is the Wellhub partner id. You may use it to identify each of your units in your Wellhub validations reports. |
Gym: { product: { “Id”: XXX , “description”: “XXXXXXX”} | These are the identifications of the validated product for a validated check-in. You may use it to identify the validated product for your staff in real-time, just after the validation. |
“validated_at”: “YYYY-MM-DDThh:mm:ssTZ” | This is the date and time of each check-in validation. You may use it for consultations by your staff in real-time or as a data register in your system. |
Use case: if you have a front desk staff, they could use the product information to give proactive orientation and offer them a better experience. |
Return Codes
When a call is made to the Access Control API we will respond back with one of the following Status.
If the request was successful and we have validated the Check-in request we will respond with a 200 and no content.
If however, there is an error in the request, we will respond with one of the below HTTP statuses.
Return Code flow
To add further clarity around why you have received either a 400 or 404 error you can review the flows below.
404 Not Found
400 Bad Request
400 Bad Request
400 Bad Request
UML Sequence Diagram
Here you will find an example of the Access Control API workflow for a Wellhub user making a subsequent visit to a gym facility, checking in on the Wellhub app, and triggering our Access Control API. Once the API is called, this will activate the validation payment to our gym partner.
Please Note: Wellhub users will need to be added to the gym CMS system and Access Control system on their first visit and be provided with the means to interact with your Access Control system (RFID Card, PIN Code, Fingerprint, etc.)
Custom codes
The custom code is the CMS internal code that allows the subscriber to enter the facility. Such as; A QR Code or PIN Code which needs to be used to grant access to the gym. These APIs allow you to send these codes to Wellhub to be used by the subscribers when entering the partner's location.
POST - Create
Creates a given custom code associated with the Wellhub ID (Gympass ID) and the given partner (Gym ID)
https://api.partners.gympass.com/access/v1/code/:wellhub_id
Example1curl -X POST https://api.partners.gympass.com/access/v1/code/${wellhub_id} \2 -H 'Content-Type: application/json' \3 -H 'Authorization: Bearer {{Wellhub BEARER Token}}' \4 -H 'X-Gym-Id: ${GYM_ID}' \5 -d '{ "custom_code": "XXXXXXXXXXXXX" }'
Path Variables
Field | Description |
---|---|
wellhub_id | Required field. String, This is the user’s wellhub_id with 13 digits, and the "value/option" will require previous check-in at the gym. |
Params
Field | Description |
---|---|
custom_code | Required field. String, This is the custom code that the CMS wishes to use by this user to check-in at this gym. It cannot be blank, and its maximum size is 13 chars. |
Headers
Field | Description |
---|---|
X-Gym-Id | Required field |
This is the ID of the gym you’re setting up. Choose it according to the list of gyms you manage. | |
Content-Type | Required field |
The Content-Type entity-header is used to indicate the media type of the resource. Use always application/json | |
Authorization | Required field |
The key is a string that is generated for you and identifies you and the gyms you are allowed to validate products for. To request yours please contact Wellhub Technical Sales. |
Response
Example1{2 "metadata": {3 "total": 1,4 "errors": 05 },6 "results": {}7}
Return Codes
HTTP Status | code | description |
---|---|---|
201 Created | ||
400 Bad Request | {"metadata":{"total":0,"errors":1},"errors":[{"message":"length must be between 1 and 13 characters","key":"custom_code"}]} | Custom code is invalid. |
409 Conflict | {"metadata":{"total":0,"errors":1},"errors":[{"message":"Already exists a custom code for that gym and user","key":"checkin.custom-code.already-exists"}]} | Already exists a code for that gympass_id and gym_id, if you wish to update it use the PUT method. |
403 Forbidden | {"metadata": { "total": 0, "errors": 1},"errors": [ { "Message": "User is not authorized to access this resource with an explicit deny" }]} | The API Key is no longer valid. |
500 Internal Server Error | {"metadata":{"total":0,"errors":1},"errors":[{"message":"There was an unexpected internal server error","key":"checkin.custom-code.unexpected-error"}]} | Unexpected Error. |
PUT - Update
Updates an existing custom code associated with the Wellhub ID (Gympass ID) and the given partner (Gym ID)
https://api.partners.gympass.com/access/v1/code/:wellhub_id
Example1curl -X PUT https://api.partners.gympass.com/access/v1/code/${wellhub_id} \2 -H 'Content-Type: application/json' \3 -H 'Authorization: Bearer {{Wellhub BEARER Token}}' \4 -H 'X-Gym-Id: ${GYM_ID}' \5 -d '{ "custom_code": "XXXXXXXXXXXXX" }'
Path Variables
Field | Description |
---|---|
wellhub_id | Required field. String, This is the user’s wellhub_id with 13 digits, and the "value/option" will require previous check-in at the gym. |
Params
Field | Description |
---|---|
custom_code | Required field. String, This is the custom code that the CMS wishes to use by this user to check-in at this gym. It cannot be blank, and its maximum size is 13 chars. |
Headers
Field | Description |
---|---|
X-Gym-Id | Required field |
This is the ID of the gym you’re setting up. Choose it according to the list of gyms you manage. | |
Content-Type | Required field |
The Content-Type entity-header is used to indicate the media type of the resource. Use always application/json | |
Authorization | Required field |
The key is a string that is generated for you and identifies you and the gyms you are allowed to validate products for. To request yours please contact Wellhub Technical Sales. |
Response
Example1{2 "metadata": {3 "total": 1,4 "errors": 05 },6 "results": {}7}
Return Codes
HTTP Status | code | description |
---|---|---|
200 Ok | ||
400 Bad Request | {"metadata":{"total":0,"errors":1},"errors":[{"message":"length must be between 1 and 13 characters","key":"custom_code"}]} | Custom code is invalid. |
404 Not Found | {"metadata":{"total":0,"errors":1},"errors":[{"message":"Custom code not found in database","key":"checkin.custom-code.not-found"}]} | Custom code not found for that gympass_id and gym_id, if you wish to create a new one use the POST method. |
403 Forbidden | {"metadata": { "total": 0, "errors": 1},"errors": [ { "Message": "User is not authorized to access this resource with an explicit deny" }]} | The API Key is no longer valid. |
500 Internal Server Error | {"metadata":{"total":0,"errors":1},"errors":[{"message":"There was an unexpected internal server error","key":"checkin.custom-code.unexpected-error"}]} | Unexpected Error. |
DELETE - Delete
Deletes an existing custom code associated with the Wellhub ID (Gympass ID) and the given partner (Gym ID)
https://api.partners.gympass.com/access/v1/code/:wellhub_id
Example1curl -X DELETE https://api.partners.gympass.com/access/v1/code/${wellhub_id} \2 -H 'Authorization: Bearer {{Wellhub BEARER Token}}' \3 -H 'X-Gym-Id: ${GYM_ID}'
Path Variables
Field | Description |
---|---|
wellhub_id | Required field. String, This is the user’s wellhub_id with 13 digits, and the "value/option" will require previous check-in at the gym. |
Headers
Field | Description |
---|---|
X-Gym-Id | Required field |
This is the ID of the gym you’re setting up. Choose it according to the list of gyms you manage. | |
Authorization | Required field |
The key is a string that is generated for you and identifies you and the gyms you are allowed to validate products for. To request yours please contact Wellhub Technical Sales. |
Response
Example1{2 "metadata": {3 "total": 1,4 "errors": 05 },6 "results": {}7}
Return Codes
HTTP Status | code | description |
---|---|---|
204 No Content | ||
400 Bad Request | {"metadata":{"total":0,"errors":1},"errors":[{"message":"length must be between 1 and 13 characters","key":"custom_code"}]} | Custom code is invalid. |
404 Not Found | {"metadata":{"total":0,"errors":1},"errors":[{"message":"Custom code not found in database","key":"checkin.custom-code.not-found"}]} | Custom code not found for that gympass_id and gym_id. |
403 Forbidden | {"metadata": { "total": 0, "errors": 1},"errors": [ { "Message": "User is not authorized to access this resource with an explicit deny" }]} | The API Key is no longer valid. |
500 Internal Server Error | {"metadata":{"total":0,"errors":1},"errors":[{"message":"There was an unexpected internal server error","key":"checkin.custom-code.unexpected-error"}]} | Unexpected Error. |