Skip to content

Book a class

The scenario is as follows: an application for club members displays the weekly schedule and allows them to book a spot in a class and cancel it.

Before you start

Let’s make sure we’re using the same terminology.

Contact

This is the customer who wants to make a booking. To avoid confusion with their potential status (prospect, member, former member ...), we will simply call them contact in this document.

Activity

This is the type of exercises practiced during a fitness class.

Studio

This is the physical location where the class takes place. A club can have multiple studios, and each studio is linked to a club.

Understanding calendars

A calendar groups different classes, and one class can belong to multiple calendars. These are different views of the available classes.

For example, a cycling class held in studio 1 of the Paris 18th club with coach John will appear in the following calendars:

  • the cycling calendar
  • the studio 1 calendar
  • John’s calendar

Note that there is no calendar tied to the club itself. To do so, you must query all calendars for the club’s studios.

Querying classes for a given period

Before booking, it is common to display the list of classes scheduled for a given period. You can therefore query either a complete list or a partial view related to specific calendars.

Make a GET request to the Resamania API as follows:

https://{api_base_url}/{client_token}/events?startedAt={started_at}&endedAt={ended_At}&calendars[]={calendar_id}

See the table below for query parameters:

parameterdescription
api_base_urlThe API URL you want to use. This varies between integration and production environments
client_tokenEach club chain has a unique Resamania identifier called client_token
started_atStart date and time (inclusive). Format YYYY-MM-ddTHH:mm:ss, e.g. 2019-09-30T00:00:00
ended_atEnd date and time (inclusive). Format YYYY-MM-ddTHH:mm:ss, e.g. 2019-09-30T24:00:00
calendars[]List of calendars to query. A calendar is identified by the textual ID of its resource. For example, for a coach: /{client_token}/coaches/{id}

Getting activities

When displaying the schedule, querying the activity reference is essential.

Make a GET request to the Resamania API as follows:

https://{api_base_url}/{client_token}/activities?archived=true
parameterdescription
api_base_urlThe API URL you want to use. This varies between integration and production environments
client_tokenEach club chain has a unique Resamania identifier called client_token
archivedInclude archived activities (false by default)

Getting studios

Just like activities, querying the studio reference is unavoidable.

Make a GET request to the Resamania API as follows:

https://{api_base_url}/{client_token}/studios

Getting coaches

The last unavoidable reference when working with calendars is the list of coaches.

Make a GET request to the Resamania API as follows:

https://{api_base_url}/{client_token}/coaches

Booking a class

Once the class is identified, the contact’s participation must be declared. The booking will automatically be placed depending on availability:

  • in the main attendee list
  • in the waitlist, which overflows from the main list
  • in the rejection list once the waitlist is full

It is possible to predict placement with the class data.

Make a POST request to the Resamania API as follows:

https://{api_base_url}/{client_token}/attendees/

Body

json5
{
    "classEvent": "{class_event_id}",
    "contactClubId": "{club_id}",
    "contactCreatedAt": "{created_at}",
    "contactFamilyName": "{family_name}",
    "contactGivenName": "{given_name}",
    "contactId": "{contact_id}",
    "contactNumber": "{contact_number}",
    "contactPictureId": "{picture_id}"
}
parameterdescription
api_base_urlThe API URL you want to use. This varies between integration and production environments
client_tokenEach club chain has a unique Resamania identifier called client_token
class_event_idTextual identifier of the class to book. Format: /{client_token}/class_events/{id}
club_idTextual identifier of the contact’s club
created_atCreation date of the contact participating in the class
family_nameLast name of the contact
given_nameFirst name of the contact
contact_idTextual identifier of the contact
contact_numberMembership number of the contact
picture_idTextual identifier of the contact’s profile picture

Canceling a booking

Canceling a booking means changing its state, not deleting it “physically.”

Make a POST request to the Resamania API as follows:

https://{api_base_url}/{client_token}/attendees/{attendee_id}/transitions

Body

json5
{
    "transition": "cancel"
}
parameterdescription
api_base_urlThe API URL you want to use. This varies between integration and production environments
client_tokenEach club chain has a unique Resamania identifier called client_token
attendee_idIdentifier of the booking to cancel

List of possible errors

During the booking and cancellation process, several business rules configured by the client may prevent booking or cancellation. Here is the list of error codes you may encounter and their definitions:

Error codeDescription
api.error.attendee.event-in-the-pastThe class start date has already passed
api.error.attendee.already-attendingYou are already registered for the class
api.error.attendee.contact-attendees-blockedYou are no longer allowed to book
api.error.attendee.contact-debtBooking impossible because you have an outstanding debt
api.error.attendee.no-unitsYou don’t have a booklet
api.error.attendee.no-valid-counter-creditYou don’t have a booklet for this event with enough credits
api.error.attendee.no-valid-counter-typeYou don’t have a booklet matching this event
api.error.attendee.no-valid-tagYou don’t have a membership matching this event
api.error.attendee.is-suspendedBooking impossible because your membership is suspended on this date
api.error.attendee.limit-reachedNo more spots available for this event
api.error.attendee.limitYou have exceeded the allowed number of bookings
api.error.attendee.anticipationThe anticipation period is not respected
api.error.attendee.automatic-rejectThe class does not accept bookings
api.error.attendee.club-restrictionYou don’t have a membership or booklet allowing you to book a class in this club
api.error.attendee.coach-restrictionYou don’t have a membership or booklet allowing you to book a class with this coach
api.error.attendee.deadlineThe deadline is not respected
api.error.attendee.delay-exceedThe cancellation deadline is not respected
api.error.attendee.missing-mandateBooking impossible because you don’t have a valid mandate
api.error.attendee.no-counters-with-ruleYou don’t have a booklet matching this event
api.error.attendee.no-tags-with-ruleYou don’t have a membership matching this event
api.error.attendee.no-tagsYou don’t have a membership
api.error.attendee.online.limitOnline booking limit reached
api.error.attendee.period-restrictionThe time restriction is not respected
api.error.attendee.studio-restrictionYou cannot book this event
api.error.attendee.tags-and-countersYou don’t have a membership or a booklet
api.error.attendee.tags-or-countersYou have neither a valid membership nor a booklet for booking
api.error.attendee.unable-to-debitUnable to debit the booklet(s) at this time