CAPI - Self Training Booking

Introduction

This document guides the developer on how to use CAPI services to book a Self Training session. ​ The reader is advised to familiarise himself/herself with the Self Training> Booking process by reading CReME - Self Training Booking before this. The user is also assumed to be familiar with CAPI - Introduction.

Displaying the Webpage

Displaying the webpage requires:

This image shows the Location dropdown list and the panel
Populating the Location Dropdown List

To populate the Dropdown List, the following request is submitted: ​

[
{
"Id": 1588811,
"ClassLocationId": 1588811,
"Title": "FOD",
"ClubCode": "A",
"TitleClubCode": "FOD, A",
"Description": null
},
{
"Id": 1588914,
"ClassLocationId": 1588914,
"Title": "Workout Zone",
"ClubCode": "A",
"TitleClubCode": "Workout Zone, A",
"Description": null
}
]
Populating the Panel of Session Icons

To populate the panel of session icons, the following request is submitted: ​

{
"DurationInMinutes": 120,
"BookingOpensInHoursBeforeStart": 72,
"Capacity": 2,
"Days": [
{
"StartOfFirstSessionHour": 0,
"StartOfFirstSessionHourString": "00",
"StartOfFirstSessionMinute": 0,
"StartOfFirstSessionMinuteString": "00",
"StartOfLastSessionHour": 0,
"StartOfLastSessionHourString": "00",
"StartOfLastSessionMinute": 0,
"StartOfLastSessionMinuteString": "00",
"NoSessionsScheduled": false,
"Tarikh": "2020-07-03T00:00:00",
"Sessions": [
{
"ClassLocationId": 1588811,
"StartTime": "2020-07-03T06:00:00",
"Status": "past",
"Identifier": "1588811_202007030600"
},
{
"ClassLocationId": 1588811,
"StartTime": "2020-07-03T08:00:00",
"Status": "past",
"Identifier": "1588811_202007030800"
},
{
"ClassLocationId": 1588811,
"StartTime": "2020-07-03T10:00:00",
"Status": "past",
"Identifier": "1588811_202007031000"
},
{
"ClassLocationId": 1588811,
"StartTime": "2020-07-03T12:00:00",
"Status": "past",
"Identifier": "1588811_202007031200"
},
{
"ClassLocationId": 1588811,
"StartTime": "2020-07-03T14:00:00",
"Status": "past",
"Identifier": "1588811_202007031400"
},
{
"ClassLocationId": 1588811,
"StartTime": "2020-07-03T16:00:00",
"Status": "past",
"Identifier": "1588811_202007031600"
},
{
"ClassLocationId": 1588811,
"StartTime": "2020-07-03T18:00:00",
"Status": "mine",
"Identifier": "1588811_202007031800"
},
{
"ClassLocationId": 1588811,
"StartTime": "2020-07-03T20:00:00",
"Status": "available",
"Identifier": "1588811_202007032000"
}
]
},
{
"StartOfFirstSessionHour": 0,
"StartOfFirstSessionHourString": "00",
"StartOfFirstSessionMinute": 0,
"StartOfFirstSessionMinuteString": "00",
"StartOfLastSessionHour": 0,
"StartOfLastSessionHourString": "00",
"StartOfLastSessionMinute": 0,
"StartOfLastSessionMinuteString": "00",
"NoSessionsScheduled": false,
"Tarikh": "2020-07-04T00:00:00",
"Sessions": [
{
"ClassLocationId": 1588811,
"StartTime": "2020-07-04T07:00:00",
"Status": "available",
"Identifier": "1588811_202007040700"
},
{
"ClassLocationId": 1588811,
"StartTime": "2020-07-04T09:00:00",
"Status": "available",
"Identifier": "1588811_202007040900"
},
{
"ClassLocationId": 1588811,
"StartTime": "2020-07-04T11:00:00",
"Status": "mine",
"Identifier": "1588811_202007041100"
},
{
"ClassLocationId": 1588811,
"StartTime": "2020-07-04T13:00:00",
"Status": "available",
"Identifier": "1588811_202007041300"
},
{
"ClassLocationId": 1588811,
"StartTime": "2020-07-04T15:00:00",
"Status": "available",
"Identifier": "1588811_202007041500"
},
{
"ClassLocationId": 1588811,
"StartTime": "2020-07-04T17:00:00",
"Status": "available",
"Identifier": "1588811_202007041700"
},
{
"ClassLocationId": 1588811,
"StartTime": "2020-07-04T19:00:00",
"Status": "available",
"Identifier": "1588811_202007041900"
}
]
},
{
"StartOfFirstSessionHour": 0,
"StartOfFirstSessionHourString": "00",
"StartOfFirstSessionMinute": 0,
"StartOfFirstSessionMinuteString": "00",
"StartOfLastSessionHour": 0,
"StartOfLastSessionHourString": "00",
"StartOfLastSessionMinute": 0,
"StartOfLastSessionMinuteString": "00",
"NoSessionsScheduled": false,
"Tarikh": "2020-07-05T00:00:00",
"Sessions": [
{
"ClassLocationId": 1588811,
"StartTime": "2020-07-05T08:00:00",
"Status": "available",
"Identifier": "1588811_202007050800"
},
{
"ClassLocationId": 1588811,
"StartTime": "2020-07-05T10:00:00",
"Status": "available",
"Identifier": "1588811_202007051000"
},
{
"ClassLocationId": 1588811,
"StartTime": "2020-07-05T12:00:00",
"Status": "available",
"Identifier": "1588811_202007051200"
},
{
"ClassLocationId": 1588811,
"StartTime": "2020-07-05T14:00:00",
"Status": "available",
"Identifier": "1588811_202007051400"
},
{
"ClassLocationId": 1588811,
"StartTime": "2020-07-05T16:00:00",
"Status": "mine",
"Identifier": "1588811_202007051600"
},
{
"ClassLocationId": 1588811,
"StartTime": "2020-07-05T18:00:00",
"Status": "available",
"Identifier": "1588811_202007051800"
},
{
"ClassLocationId": 1588811,
"StartTime": "2020-07-05T20:00:00",
"Status": "available",
"Identifier": "1588811_202007052000"
}
]
},
{
"StartOfFirstSessionHour": 0,
"StartOfFirstSessionHourString": "00",
"StartOfFirstSessionMinute": 0,
"StartOfFirstSessionMinuteString": "00",
"StartOfLastSessionHour": 0,
"StartOfLastSessionHourString": "00",
"StartOfLastSessionMinute": 0,
"StartOfLastSessionMinuteString": "00",
"NoSessionsScheduled": false,
"Tarikh": "2020-07-06T00:00:00",
"Sessions": [
{
"ClassLocationId": 1588811,
"StartTime": "2020-07-06T06:00:00",
"Status": "available",
"Identifier": "1588811_202007060600"
},
{
"ClassLocationId": 1588811,
"StartTime": "2020-07-06T08:00:00",
"Status": "available",
"Identifier": "1588811_202007060800"
},
{
"ClassLocationId": 1588811,
"StartTime": "2020-07-06T10:00:00",
"Status": "available",
"Identifier": "1588811_202007061000"
},
{
"ClassLocationId": 1588811,
"StartTime": "2020-07-06T12:00:00",
"Status": "available",
"Identifier": "1588811_202007061200"
},
{
"ClassLocationId": 1588811,
"StartTime": "2020-07-06T14:00:00",
"Status": "available",
"Identifier": "1588811_202007061400"
},
{
"ClassLocationId": 1588811,
"StartTime": "2020-07-06T16:00:00",
"Status": "available",
"Identifier": "1588811_202007061600"
},
{
"ClassLocationId": 1588811,
"StartTime": "2020-07-06T18:00:00",
"Status": "available",
"Identifier": "1588811_202007061800"
},
{
"ClassLocationId": 1588811,
"StartTime": "2020-07-06T20:00:00",
"Status": "notOpenYet",
"Identifier": "1588811_202007062000"
}
]
}
]
}
The Response Header

Every response contains:

Every response header contains 3 parameters. These appear only once in each response and have been explained in CReME - Self Training Booking

The Array of Days

The number of Days varies depending on the length of BookingOpensInHoursBeforeStart. It will be the next highest integer of days after interval expires. For example, if BookingOpensInHoursBeforeStart=72 hours (3days), the next highest integer is 4. If BookingOpensInHoursBeforeStart=36 hours (1.5days), the number of Days returned will be 2. Please confirm with the customer the minimum and maximum expected values for BookingOpensInHoursBeforeStart so your code will be able to display the panel properly.

The attributes beginning with "StartOf" (StartOfFirstSessionHour etc) are not used and so will not be discussed here.

NoSessionScheduled is a boolean. False indicates there will be no Sessions for that day. True indicates there will be at least one Session during that day.

Tarikh (the Malaysian word for "date") will appear in yyyy-MM-ddTHH:mm:ss format but only the yyyy, MM and dd values will be used. The HH, mm and ss values for Daywill always be zero.

The Array of Sessions

The number of Sessions per day can vary. This has been explained above under NoSessionsSechduled

ClassLocationId is the same ClassLocationId in the request. It is the same for all Sessions.

StartTime is when the Session is scheduled to begin. It will appear in yyyy-MM-ddTHH:mm:ss format. All values (yyyy, MM, dd, HH, mm and ss) will be used.

An explanation of possible values for SessionStatus can be found in CReME - Self Training Booking

SessionIdentifier is unique for each Session. This will be used later when booking a Session

Booking a Session

After a user clicks on an available icon, the icon changes to click to confirm. Clicking Confirm sends the following request to CAPI:

{
"Code": "87.51.0",
"Description": "SelfTraining booking success",
"Payload": ""
}

If the booking is successful, the user receives a confirmation by email. This has been described in CReME - Self Training Booking.

For a list of StatusMessages, please refer to the StatusMessage page in CReME™. The relevant StatusMessages can be found under Entity.Action of ClassInstancePerson.CreateST.