Endpoints
Classes
A class represents one of the gym’s classes, like "weightlifting" or "yoga". To show the class on the Wellhub app and website, you need to create a slot that combines the class with a specific date and time it will occur. See the slots session to see how to register a slot.
POST - Create
Creates a list of classes in a given gym.
{{booking-api-url}}/booking/v1/gyms/:gym_id/classes
Example Request1curl --location --request POST '{{booking-api-url}}/booking/v1/gyms/1/classes' \2--header 'Content-Type: application/json' \3--header 'Authorization: Bearer {{Wellhub Auth Token}}' \4--data-raw '{5 "classes": [6 {7 "name": "Cycle",8 "description": "Our standard cycle classes",9 "notes": "Notes of our standard cycle classes",10 "bookable": true,11 "visible": true,12 "reference": "111",13 "product_id": 1,14 "categories": [1, 2]15 }16 ]17}'
Request Params
Field | Description | Type | Required |
---|---|---|---|
name | It's the human-readable name of the class. Max of 255 characters. | String | True |
description | It's the human-readable description of the class. | String | True |
notes | These are the human-readable notes that you can add to the class details. | String | False |
bookable | It indicates if the class can be reserved. Values: True or False. | Boolean | True |
visible | It indicates if the class is visible on the Wellhub app and website. Set this field to False if you want to hide the class for a while. If this is set to False, all related slots won’t be shown. Values: True or False. | Boolean | True |
product_id | It's the product identifier at Wellhub (yoga, swimming). If you don’t know this, please check the Products section or ask about it to your Wellhub contact. | Int | True |
reference | It's a field used by the partner to link a class between the Wellhub Booking API and its integrated system. | String | False |
system_id | Id of partner's integrated system at Wellhub. | Int | False |
categories | Array of IDs chosen from a list of categories provided by Wellhub that specifies what kind of activity that class is about. (e.g. Yoga, Functional, Pilates...). | List - Int | False |
Headers
Field | Description |
---|---|
Content-Type | application/json |
Authorization | Bearer {{Wellhub Auth Token}} - If you do not have this token, ask it to Wellhub contact. |
Path Variables
Field | Description |
---|---|
gym_id | It's the identifier of the gym at Wellhub. Provided by Wellhub. |
Response
Example Response1{2 "classes": [3 {4 "id": 1,5 "name": "Cycle",6 "reference": "111",7 "links": [8 {9 "rel": "self",10 "href": "gyms/1/classes/1"11 }12 ]13 }14 ]15}
GET - List
GET a list of classes in a given gym.
{{booking-api-url}}/booking/v1/gyms/:gym_id/classes
Request Example1curl --location --request GET '{{booking-api-url}}/booking/v1/gyms/1/classes' \2--header 'Accept: application/json' \3--header 'Authorization: Bearer {{Wellhub Auth Token}}'
Headers
Field | Description |
---|---|
Accept | application/json |
Authorization | Bearer {{Wellhub Auth Token}} - If you do not have this token, ask it to Wellhub contact. |
Path Variables
Field | Description |
---|---|
gym_id | The identifier of the gym at Wellhub. Provided by Wellhub. |
Response Example1{2 "classes": [3 {4 "id": 1,5 "name": "Cycle",6 "slug": "cycle",7 "description": "Our standard cycle classes",8 "notes": "Notes",9 "bookable": true,10 "visible": true,11 "product_id": 1,12 "gym_id": 123,13 "reference": "111",14 "created_at": "2019-07-03T17:44:22Z[UTC]"15 },16 {17 "id": 2,18 "name": "Super Cycle",19 "slug": "super-cycle",20 "description": "Our super advanced cycle class",21 "notes": "Notes",22 "bookable": true,23 "visible": true,24 "product_id": 1,25 "gym_id": 123,26 "reference": "111",27 "created_at": "2019-07-03T17:44:22Z[UTC]",28 "categories": [29 {30 "id": 1,31 "name": "Meditation",32 "locale": "de"33 }34 ]35 }36 ]37}
GET - Get
GET a specific class resource.
{{booking-api-url}}/booking/v1/gyms/:gym_id/classes/:class_id?show-deleted=false
Request example1curl --location --request GET '{{booking-api-url}}/booking/v1/gyms/:gym_id/classes/:class_id?show-deleted=false' \2--header 'Accept: application/json' \3--header 'Authorization: Bearer {{Wellhub Auth Token}}'
Headers
Field | Description |
---|---|
Content-Type | application/json |
Authorization | Bearer {{Wellhub Auth Token}} - If you do not have this token, ask it to Wellhub contact. |
Path Variables
Field | Description |
---|---|
gym_id | The identifier of the gym at Wellhub. Provided by Wellhub. |
class_id | The identifier of the class at Wellhub. Returned when creating a Class. |
Query String Parameters
Field | Description |
---|---|
show-deleted (Optional) | true Shows the deleted class. false {default} Does not show the deleted class |
show-deleted=true
Will show the results for both Class_ids that have been deleted and that are non-deleted.show-deleted=false
will only show non-deleted Class_ids
Response
Response Example1{2 "id": 1,3 "name": "Judo",4 "slug": "judo-class-with-lasers",5 "description": "Description for judo classes.",6 "notes": "Some pretty notes here.",7 "bookable": true,8 "visible": true,9 "product_id": 1,10 "gym_id": 1,11 "reference": "111",12 "created_at": "2019-07-03T17:44:22Z[UTC]",13 "categories": [14 {15 "id": 1,16 "name": "Meditation",17 "locale": "de"18 }19 ],20}
PUT - Update
Updates the class.
{{booking-api-url}}/booking/v1/gyms/:gym_id/classes/:class_id
Request Example1curl --location --request PUT '{{booking-api-url}}/booking/v1/gyms/1/classes/1' \2--header 'Content-Type: application/json' \3--header 'Authorization: Bearer {{Wellhub Auth Token}}' \4--data-raw '{5 "name": "Super Cycle",6 "description": "Our standard cycle classes",7 "notes": "Notes of our standard cycle classes",8 "bookable": true,9 "visible": true,10 "reference": "111",11 "product_id": 1,12 "categories": [1,2]13}'
Request Params
Field | Description | Type | Required |
---|---|---|---|
name | It's the human-readable name of the class. Max of 255 characters. | String | True |
description | It's the human-readable description of the class. | String | True |
notes | These are the human-readable notes that you can add to the class details. | String | False |
bookable | It indicates if the class can be reserved. Values: True or False. | Boolean | True |
visible | It indicates if the class is visible on the Wellhub app and website. Set this field to False if you want to hide the class for a while. If this is set to False, all related slots won’t be shown. Values: True or False. | Boolean | True |
product_id | It's the product identifier at Wellhub (yoga, swimming). If you don’t know this, please check the Products section or ask about it to your Wellhub contact. | Int | True |
reference | It's a field used by the partner to link a class between the Wellhub Booking API and its integrated system. | String | False |
categories | Array of IDs chosen from a list of categories provided by Wellhub that specifies what kind of activity that class is about. (e.g. Yoga, Functional, Pilates...) | List - Int | False |
Headers
Field | Description |
---|---|
Content-Type | application/json |
Authorization | Bearer {{Wellhub Auth Token}} - If you do not have this token, ask it to Wellhub contact. |
Path Variables
Field | Description |
---|---|
gym_id | The identifier of the gym at Wellhub. Provided by Wellhub. |
class_id | The identifier of the class at Wellhub. Returned when creating a Class. |
Response
200 - OK
Slots
A slot represents a class with specific date and time. For example, you can have a class called Yoga with a slot on Sunday at 9 AM and another slot on Monday at 8 AM.
A slot is always related to a class that was previously registered. See class session to find out how to register a class.
POST - Create
{{booking-api-url}}/booking/v1/gyms/:gym_id/classes/:class_id/slots
Creates a slot on a given class.
Request Example1curl --location --request POST '{{booking-api-url}}/booking/v1/gyms/1/classes/1/slots' \2--header 'Content-Type: application/json' \3--header 'Authorization: Bearer {{Wellhub Auth Token}}' \4--data-raw '{5 "occur_date": "2019-07-30T10:00:00-05:00",6 "room": "Room 1",7 "status": 1,8 "length_in_minutes": 60,9 "total_capacity": 15,10 "total_booked": 5,11 "product_id": 1,12 "booking_window": {13 "opens_at": "2019-07-01T01:00:00-05:00",14 "closes_at": "2019-07-30T09:00:00-05:00"15 },16 "instructors": [17 {18 "name": "Axel",19 "substitute": false20 },21 {22 "name": "Blaze",23 "substitute": true24 }25 ],26 "cancellable_until": "2019-07-29T20:00:00-05:00",27 "rating": 4.5,28 "virtual": true,29 "virtual_class_url": "http://your_url.com"30}'
Request Params
Field | Description | Type | Required | Validations* |
---|---|---|---|---|
occur_date | The class slot time should be entered based on the location of the gym. Ex: 2019-07-30T10:00:00-05:00 will create a class on July 30th 10AM for a gym located in the East Coast timezone, UTC -5. | Date | True | Format should be valid Should be in the future |
room | It's the human-readable room name at the gym. | String | False | String size between 2 and 200 characters |
status | It’s the slot status. The default value is 1. Values: inactive = 0 or active = 1. | Int | False | - |
length_in_minutes | It's the class duration in minutes. | Int | True | Between 1 and 200 |
total_capacity | It's the total capacity of users on a given class slot. For example, if you just have 10 bikes, you can set it to 10. | Int | True | Between 0 and 32000 |
total_booked | It's the total amount of bookings on a given class slot. Note that every time a class slot is booked through the Wellhub app and website or not, the best practice is that you update this information using this endpoint. This way we can always show properly the slots that you already have available, providing the best experience to the users. | Int | True | Between 0 and 32000 Should be lees or equal than total_capacity |
product_id | It's the product identifier at Wellhub (yoga, swimming). If you don’t know this, please check the Products section or ask about it to your Wellhub contact. | Int | True | Related to product validation described on other validations |
cancellable_until | There is a hardcoded max limit of 24 hours' notice for cancellations if the cancellation window exceeds this, the cancellation window will default to 24 hours before the class starts. Ex: 2019-07-30T10:00:00-05:00 | Date | False | Should be before or at occur_date Should be older than 60 days |
rating | Rating value | Decimal | False | Between 0.0 and 5.0 |
booking_window | Booking window represents the date and time that a user can book a slot. If the user is outside of this range of dates and times they can’t book this slot. The booking window is composed of the "opens_at" and "closes_at" attributes explained below. | Decimal | False | - |
opens_at | The opening time to book a class slot. It should be entered based on the location of the gym. Ex: 2019-07-20T13:00:00-05:00. If none is informed, the slot will be available just after creation. | Date | False | Format should be valid Should be before occur_date Should be within last 60 days |
closes_at | The limit time to book a class slot. It should be entered based on the location of the gym. Ex: 2019-07-29T21:00:00-05:00. If none is informed the slot will be considered closed to be booked at occur_date | Date | False | Format should be valid Should be before or at occur_date Should be within last 60 days Should be after opens_at |
instructors | You can set none or multiple instructors for a class slot. This represents a list of the instructors, and for each one you can send the instructor's "name" and whether they are a "substitute" or not, as explained below. | List | False | - |
name | The name of the instructor. | String | True | String size between 1 and 100 characters |
substitute | Indicates if it’s a substitute instructor. Values: True or False. | Boolean | True | - |
virtual | Indicates if the class slots is virtual or presential. It must match the product virtual flag, returned by the GET Products endpoint. | Boolean | False | Related to product validation described on other validations |
virtual_class_url | If this is a virtual class, you can put here the URL that the user will need to use to access the class virtually. | String | False | Should start with http:// or https:// (valilated only when virtual is true ) |
*If not valid returns Bad Request (400 HTTP status code)
Other validations
Validation | HTTP status code |
---|---|
Slot should be unique (Uniqueness based on class, occur_date, and room) | 409 |
Product should be valid (Should exist and be a virtual product when a slot is being created as virtual) | 422 |
Headers
Field | Description |
---|---|
Accept | application/json |
Authorization | Bearer {{Wellhub Auth Token}} - If you do not have this token, ask it to Wellhub contact. |
Path Variables
Field | Description |
---|---|
gym_id | The identifier of the gym at Wellhub. Provided by Wellhub. |
class_id | The identifier of the class at Wellhub. Returned when creating a Class. |
Response
201 - Created1{2 "metadata": {3 "total": 1,4 "errors": 05 },6 "results": [7 {8 "id": 1,9 "class_id": 1,10 "occur_date": "2019-07-30T10:00:00-05:00",11 "status": 1,12 "room": "Room 1",13 "length_in_minutes": 60,14 "total_capacity": 15,15 "total_booked": 5,16 "product_id": 1,17 "booking_window": {18 "opens_at": "2019-07-01T01:00:00-05:00",19 "closes_at": "2019-07-30T09:00:00-05:00"20 },21 "cancellable_until": "2019-07-29T20:00:00-05:00",22 "instructors": [23 {24 "name": "Axel",25 "substitute": false26 },27 {28 "name": "Blaze",29 "substitute": true30 }31 ],32 "rating": 4.5,33 "virtual": true,34 "virtual_class_url": "http://your_url.com"35 }36 ]37}
GET - Get
{{booking-api-url}}/booking/v1/gyms/:gym_id/classes/:class_id/slots/:slot_id
Request example1curl --location --request GET '{{booking-api-url}}/booking/gyms/1/classes/1/slots/1' \2--header 'Accept: application/json' \3--header 'Authorization: Bearer {{Wellhub Auth Token}}'
Headers
Field | Description |
---|---|
Accept | application/json |
Authorization | Bearer {{Wellhub Auth Token}} - If you do not have this token, ask it to Wellhub contact. |
Path Variables
Field | Description |
---|---|
gym_id | The identifier of the gym at Wellhub. Provided by Wellhub. |
class_id | The identifier of the class at Wellhub. Returned when creating a Class. |
slot_id | The identifier of the slot at Wellhub. Returned when creating a Slot. |
Response
200 - OK1{2 "id": 1,3 "class_id": 1,4 "occur_date": "2019-07-09T10:00:00-03:00",5 "status": 1,6 "room": "Room 1",7 "length_in_minutes": 60,8 "total_capacity": 15,9 "total_booked": 5,10 "product_id": 1,11 "booking_window": {12 "opens_at": "2019-07-08T00:00:00-03:00",13 "closes_at": "2019-07-09T09:00:00-03:00"14 },15 "cancellable_until": "2019-07-09T09:08:00-03:00",16 "instructors": [17 {18 "name": "Axel",19 "substitute": false20 },21 {22 "name": "Blaze",23 "substitute": true24 }25 ],26 "rating": 4.5,27 "virtual": true,28 "virtual_class_url": "http://your_url.com"29}
GET - List
Return a list with slots of a given class in a given range of timezoned dates. If no form/to is informed, we will return all slots on that day.
{{booking-api-url}}/booking/v1/gyms/:gym_id/classes/:class_id/slots?from=2019-09-09T00:00:00%2B03:00&to=2019-09-09T23:59:59%2B03:00
Request example1curl --location --request GET '{{booking-api-url}}/booking/v1/gyms/:gym_id/classes/:class_id/slots?from=2019-09-09T00:00:00%2B03:00&to=2019-09-09T23:59:59%2B03:00' \2--header 'Accept: application/json' \3--header 'Authorization: Bearer {{Wellhub Auth Token}}'
Params
Field | Description | Validations* |
---|---|---|
from | A timezone date/time to start finding slots. It should be entered based on the location of the gym. Ex: 2019-09-09T00:00:00+03:00 | Format should be valid |
to | A timezone date/time to end finding slots. It should be entered based on the location of the gym. Ex: 2019-09-09T00:00:00+03:00 | Format should be valid |
*If not valid returns Bad Request (400 HTTP status code)
Headers
Field | Description |
---|---|
Accept | application/json |
Authorization | Bearer {{Wellhub Auth Token}} - If you do not have this token, ask it to Wellhub contact. |
Path Variables
Field | Description |
---|---|
gym_id | The identifier of the gym at Wellhub. Provided by Wellhub. |
class_id | The identifier of the class at Wellhub. Returned when creating a Class. |
Response
200 - OK1{2 "metadata": {3 "page": 1,4 "page_size": 1000,5 "total_elements": 1,6 "total": 1,7 "errors": 08 },9 "results": [10 {11 "id": 10849748,12 "class_id": 627457,13 "occur_date": "2021-03-09T07:00:00Z[UTC]",14 "status": 1,15 "room": "Room 1",16 "length_in_minutes": 60,17 "total_capacity": 15,18 "total_booked": 5,19 "product_id": 478142,20 "booking_window": {21 "opens_at": "2021-03-09T06:30:00Z[UTC]",22 "closes_at": "2021-03-09T07:00:00Z[UTC]"23 },24 "cancellable_until": "2021-03-09T07:00:00Z[UTC]",25 "instructors": [26 {27 "name": "WELLHUB TEST",28 "substitute": false29 }30 ],31 "rating": 4.5,32 "virtual": false33 }34 ]35}
DEL - Delete
Use to delete a slot forever. All bookings already done in this slot will be canceled automatically.
{{booking-api-url}}/booking/v1/gyms/:gym_id/classes/:class_id/slots/:slot_id
Request example1curl --location --request DELETE '{{booking-api-url}}/booking/v1/gyms/1/classes/1/slots/1' \2--header 'Content-Type: application/json' \3--header 'Authorization: Bearer {{Wellhub Auth Token}}' \4--data-raw ''
Headers
Field | Description |
---|---|
Accept | application/json |
Authorization | Bearer {{Wellhub Auth Token}} - If you do not have this token, ask it to Wellhub contact. |
Path Variables
Field | Value |
---|---|
gym_id | The identifier of the gym at Wellhub. Provided by Wellhub. |
class_id | The identifier of the class at Wellhub. Returned when creating a Class. |
slot_id | The identifier of the Slot at Wellhub. Returned when creating a Slot. |
Response
204 - No Content
PATCH - Update
{{booking-api-url}}/booking/v1/gyms/:gym_id/classes/:class_id/slots/:slot_id
It updates partial info of the slot. For now, it is just possible to update total_booked and/or total_capacity. We recommend as good practice inform at least one of these fields. If you need to update other slot information, please use PUT - Update.
Request Example1curl --location --request PATCH '{{booking-api-url}}/booking/v1/gyms/1/classes/1/slots/1' \2--header 'Content-Type: application/json' \3--header 'Authorization: Bearer {{Wellhub Auth Token}}' \4--data-raw '{5 "total_capacity": 15,6 "total_booked": 5,7 "virtual_class_url": "http://your_url.com"8}'
Request Params
Field | Description | Type | Required | Validations* |
---|---|---|---|---|
total_capacity | It's the total capacity of users on a given class slot. For example, if you just have 10 bikes, you can set it to 10. | Int | True, if total_booked not sent | Between 0 and 32000 |
total_booked | It's the total amount of bookings on a given class slot. Note that every time a class slot is booked, through the Wellhub app and website or not, the best practice is that you update this information using this endpoint. This way we can properly always show the slots that you already have available, providing the best experience to the users. | Int | True, if total_capacity not sent | Between 0 and 32000 Should be lees or equal than total_capacity |
virtual_class_url | If this is a virtual class, you can put here the url that the user will need to use to access the class virtually. | String | False | - |
*If not valid returns Bad Request (400 HTTP status code)
Headers
Field | Description |
---|---|
Accept | application/json |
Authorization | Bearer {{Wellhub Auth Token}} - If you do not have this token, ask it to Wellhub contact. |
Path Variables
Field | Value |
---|---|
gym_id | The identifier of the gym at Wellhub. Provided by Wellhub. |
class_id | The identifier of the class at Wellhub. Returned when creating a Class. |
slot_id | The identifier of the Slot at Wellhub. Returned when creating a Slot. |
Response
204 - No Content
PUT - Update
It updates all the info of the slot.
{{booking-api-url}}/booking/v1/gyms/:gym_id/classes/:class_id/slots/:slot_id
Request example1curl --location --request PUT '{{booking-api-url}}/booking/v1/gyms/1/classes/1/slots/1' \2--header 'Content-Type: application/json' \3--header 'Authorization: Bearer {{Wellhub Auth Token}}' \4--data-raw '{5 "occur_date": "2019-07-09T10:00:00-03:00",6 "room": "Room 1",7 "status": 1,8 "length_in_minutes": 60,9 "total_capacity": 15,10 "total_booked": 7,11 "product_id": 1,12 "booking_window": {13 "opens_at": "2019-07-08T00:00:00-03:00",14 "closes_at": "2019-07-09T09:00:00-03:00"15 },16 "instructors": [17 {18 "name": "Axel",19 "substitute": false20 },21 {22 "name": "John",23 "substitute": true24 }25 ],26 "cancellable_until": "2019-07-09T09:00:00-03:00",27 "rating": 4.5,28 "virtual": true,29 "virtual_class_url": "http://your_url.com"30}'
Request Params
Field | Description | Type | Required | Validations* |
---|---|---|---|---|
occur_date | The class slot time should be entered based on the location of the gym. Ex: 2019-07-30T10:00:00-05:00 will create a class on July 30th 10AM for a gym located in the East Coast timezone, UTC -5. | Date | True | Format should be valid Should be in the future |
room | It's the human-readable room name at the gym. | String | False | String size between 2 and 200 characters |
status | It’s the slot status. The default value is 1. Values: inactive = 0 or active = 1. | Int | False | - |
length_in_minutes | It's the class duration in minutes. | Int | True | Between 1 and 200 |
total_capacity | It's the total capacity of users on a given class slot. For example, if you just have 10 bikes, you can set it to 10. | Int | True | Between 0 and 32000 |
total_booked | It's the total amount of bookings on a given class slot. Note that every time a class slot is booked through the Wellhub app and website or not, the best practice is that you update this information using this endpoint. This way we can always show properly the slots that you already have available, providing the best experience to the users. | Int | True | Between 0 and 32000 Should be lees or equal than total_capacity |
product_id | It's the product identifier at Wellhub (yoga, swimming). If you don’t know this, please check the Products section or ask about it to your Wellhub contact. | Int | True | Related to product validation described on other validations |
cancellable_until | There is a hardcoded max limit of 24 hours' notice for cancellations if the cancellation window exceeds this, the cancellation window will default to 24 hours before the class starts. Ex: 2019-07-30T10:00:00-05:00 | Date | False | Should be before or at occur_date Should be older than 60 days |
rating | Rating value | Decimal | False | Between 0.0 and 5.0 |
booking_window | Booking window represents the date and time that a user can book a slot. If the user is outside of this range of dates and times they can’t book this slot. The booking window is composed of the "opens_at" and "closes_at" attributes explained below. | Decimal | False | - |
opens_at | The opening time to book a class slot. It should be entered based on the location of the gym. Ex: 2019-07-20T13:00:00-05:00. If none is informed, the slot will be available just after creation. | Date | False | Format should be valid Should be before occur_date Should be within last 60 days |
closes_at | The limit time to book a class slot. It should be entered based on the location of the gym. Ex: 2019-07-29T21:00:00-05:00. If none is informed the slot will be considered closed to be booked at occur_date | Date | False | Format should be valid Should be before or at occur_date Should be within last 60 days Should be after opens_at |
instructors | You can set none or multiple instructors for a class slot. This represents a list of the instructors, and for each one you can send the instructor's "name" and whether they are a "substitute" or not, as explained below. | List | False | - |
name | The name of the instructor. | String | True | String size between 1 and 100 characters |
substitute | Indicates if it’s a substitute instructor. Values: True or False. | Boolean | True | - |
virtual | Indicates if the class slots is virtual or presential. It must match the product virtual flag, returned by the GET Products endpoint. | Boolean | False | - |
virtual_class_url | If this is a virtual class, you can put here the URL that the user will need to use to access the class virtually. | String | False | Should start with http:// or https:// (valilated only when virtual is true ) |
*If not valid returns Bad Request (400 HTTP status code)
Other validations
Validation | HTTP status code |
---|---|
Product should be valid (Should exist) | 422 |
Headers
Field | Description |
---|---|
Accept | application/json |
Authorization | Bearer {{Wellhub Auth Token}} - If you do not have this token, ask it to Wellhub contact. |
Path Variables
Field | Value |
---|---|
gym_id | The identifier of the gym at Wellhub. Provided by Wellhub. |
class_id | The identifier of the class at Wellhub. Returned when creating a Class. |
slot_id | The identifier of the Slot at Wellhub. Returned when creating a Slot. |
Response
200 - OK1{2 "metadata": {3 "total": 1,4 "errors": 05 },6 "results": [7 {8 "id": 1,9 "class_id": 1,10 "occur_date": "2019-07-09T10:00:00-03:00",11 "status": 1,12 "room": "Room 1",13 "length_in_minutes": 60,14 "total_capacity": 15,15 "total_booked": 7,16 "product_id": 1,17 "booking_window": {18 "opens_at": "2019-07-08T00:00:00-03:00",19 "closes_at": "2019-07-09T09:00:00-03:00"20 },21 "cancellable_until": "2019-07-09T09:08:00-03:00",22 "instructors": [23 {24 "name": "Axel",25 "substitute": false26 },27 {28 "name": "John",29 "substitute": true30 }31 ],32 "rating": 4.5,33 "virtual": true34 }35 ]36}
Products
A Product determines what gyms a user can access on a Wellhub plan. In addition, the product also represents an activity that the user can perform, so it is data that is commonly required to provide on most requests, such as for creating a class.
For this purpose, we provide an API that allows you to retrieve all Products that are associated with a GymID, so you can use the correct Product IDs on your integration setup.
GET - Products
Displays all products associated with a GymID.
URL: {{booking-api-url}}/setup/v1/gyms/:gym_id/products
Response Example
200 - OK1{2 "gym_id": 012345,3 "products": [4 {5 "product_id": 987654,6 "name": "Swimming",7 "virtual": false,8 "updated_at": "2022-05-10T14:33:48.819005Z"9 }10 ]11}
Headers
Field | Description |
---|---|
Accept | application/json |
Authorization | Bearer {{Wellhub Auth Token}} |
Path Variables
Field | Description |
---|---|
gym_id | The identifier of the gym at Wellhub. Provided by Wellhub. |
Bookings
PATCH - Update
Important: Booking requests need to be confirmed under 15 minutes, otherwise they will be automatically rejected.
Previous version (deprecated)
{{booking-api-url}}/booking/v1/gyms/:gym_id/bookings/:booking_number
Request example1curl --location --request PATCH '{{booking-api-url}}/booking/v1/gyms/:gym_id/bookings/:booking_number' \2--header 'Authorization: Bearer {{Wellhub Token}}' \3--header 'Content-Type: application/json' \4--data-raw '{5 "class_id": 012345,6 "status": 2,7 "reason": "Reason",8 "virtual_class_url": "http://your_url.com"9}'
The above example would reserve a booking. When calling the PATCH update you must pass through either a 2 (Reserved Booking), a 3 (Rejected Booking) or 5 (Cancelled by the Gym)
Request Params
Field | Description | Type | Required |
---|---|---|---|
class_id | The class id related to that booking. | Int | True |
status | If the gym is accepting or rejecting the booking. Values: 2 (Reserved), 3 (Rejected) or 5 (Cancelled by the Gym) | Int | True |
reason | The reason is used commonly when the booking is rejected. | String | False |
virtual_class_url | If this is a virtual class, you can put here the URL that the user will need to use to access the class virtually. | String | False |
Headers
Field | Description |
---|---|
Accept | application/json |
Authorization | Bearer {{Wellhub Auth Token}} - If you do not have this token, ask it to Wellhub contact. |
Path Variables
Field | Value |
---|---|
gym_id | The identifier of the gym at Wellhub. Provided by Wellhub. |
booking_number | The booking identifier at Wellhub. Returned when creating a Booking. |
Response
204 - 0K - no content
{{booking-api-url}}/booking/v2/gyms/:gym_id/bookings/:booking_number
Request example1curl --location --request PATCH '{{booking-api-url}}/booking/v2/gyms/:gym_id/bookings/:booking_number' \2--header 'Authorization: Bearer {{Wellhub Token}}' \3--header 'Content-Type: application/json' \4--data-raw '{5 "status": "REJECTED",6 "reason": "Class is full",7 "reason_category": "CLASS_IS_FULL",8 "virtual_class_url": "http://your_url.com"9}'
The above example would reject a booking.
Request Params
Field | Description | Type | Required |
---|---|---|---|
status | If the gym is accepting or rejecting the booking. See Allowed values | String | True |
reason | The reason is used commonly when the booking is rejected. | String | False |
reason_category | The reason category is used to categorize a rejected booking. Required if the status is REJECTED. See Allowed values | String | False |
virtual_class_url | If this is a virtual class, you can put here the URL that the user will need to use to access the class virtually. | String | False |
Headers
Field | Description |
---|---|
Accept | application/json |
Authorization | Bearer {{Wellhub Auth Token}} - If you do not have this token, ask it to Wellhub contact. |
Path Variables
Field | Value |
---|---|
gym_id | The identifier of the gym at Wellhub. Provided by Wellhub. |
booking_number | The booking identifier at Wellhub. Returned when creating a Booking. |
List of status allowed
Value |
---|
RESERVED |
REJECTED |
CANCELLED_BY_GYM |
List of reason categories allowed
Value | Description |
---|---|
CLASS_IS_FULL | Booking declined because the class is full |
USAGE_RESTRICTION | Booking declined because of usage limits |
USER_IS_ALREADY_BOOKED | Booking attempt declined because you've already booked this class |
SPOT_NOT_AVAILABLE | Booking declined because there are no spots available |
USER_DOES_NOT_EXIST | Booking declined because you need to visit the partner to register first |
CHECK_IN_AND_CANCELATION_WINDOWS_CLOSED | Booking declined because you are not able to book this class right now |
CLASS_HAS_BEEN_CANCELED | Booking declined because the class is no longer available |
CLASS_NOT_FOUND | Booking declined because the class wasn't found |
USER_PROFILE_CMS | Booking declined because of a user profile error |
PREREQUISITES | Booking declined because this class has prerequisites |
GENERAL_ERROR | Booking declined because something went wrong |
TECHNICAL_ERROR | Booking declined because of a technical error. To be used in case of a technical issue (non-business related) e.g System outage |
Response
204 - 0K - no content
Categories
A class category is an ID chosen from a list of categories provided by Wellhub that specifies what kind of activity that class is about. (e.g. Yoga, Functional, Pilates...)
GET - List
{{booking-api-url}}/booking/v1/gyms/:gym_id/categories?locale={{locale}}
Request example1curl --location --request GET '{{booking-api-url}}/booking/v1/gyms/:gym_id/categories?locale={{locale}}' \2--header 'Authorization: Bearer {{Wellhub Token}}'
Headers
Field | Description |
---|---|
Accept | application/json |
Authorization | Bearer {{Wellhub Auth Token}} |
Path Variables
Field | Value |
---|---|
locale | The locale of the gym. eg: pt |
List of locales values allowed:
Locale |
---|
de |
en |
en_GB |
es |
fr |
it |
nl |
pt |
pt_PT |
en_IE |
es_AR |
es_CL |
es_MX |
es_UY |
Response
200 - 0K1{2 "metadata": {3 "total": 1,4 "errors": 05 },6 "results": [7 {8 "id": 1,9 "name": "Meditation",10 "locale": "de"11 }12 ]13}
Health Check
GET - Health
{{booking-api-url}}/booking/v1/health
Request example1curl --location --request GET '{{booking-api-url}}/booking/v1/health' \2--header 'Authorization: Bearer {{Wellhub Auth Token}}'
Response example | Status 2001ok
Headers
Field | Description |
---|---|
Authorization | Bearer {{Wellhub Auth Token}} - If you do not have this token, ask it to Wellhub contact. |
UML Sequence Diagram
Here you will find examples of the Booking API workflow. The examples below will highlight the following:
More detail