New API available - faster and more powerful!

Check it out!
Perfect Gym api
Deprecated - API v1 will be switched off on 01.07.2022. Please upgrade to API v2

Booking

This API allow users to sign up (book) and sign out (cancel) for fitness classes.

Execute class booking alt text alt text

POST Classes/BookClass

Signs up user for fitness class.

Employee mode parameters

Name Type Description
classId long Required. Class identifier. Request signs up user for fitness class identified with classId.
userId long Required. User identifier. Request signs up user identified with userId for fitness class.
seatNumber int When class allow book a seat number, you can pass specific seat number to book. Book given seat or first available.

User mode parameters

Name Type Description
classId long Required. Class identifier. Request signs up authenticated user for fitness class identified by classId.
seatNumber int When class allow book a seat number, you can pass specific seat number to book. Book given seat or first available.

Response

Class details if booking is successful, or collection of errors with class booking error codes otherwise.

Employee mode example request

In this example we sign up user with id = 40 for classes with id = 1677

curl -i 
     -X POST 
     -H "Authorization: Bearer  $ACCESS_TOKEN"  
     http://yoursubdomain.perfectgym.com/Api/Classes/BookClass/
        ?classId=1677
        &userId=40

Example response

Status: 200 OK
{
  "elements": [
    {
      "booked": true,
      "attended": false,
      "standby": false,
      "userClassRating": "",
      "userInstructorRating": "",
      "classType": {
        "id": 1,
        "timestamp": 263952,
        "name": "Box",
        "photoUrl": "",
        "iconUrl": "",
        "description": "Box perfectly combines cardio and strength training under the guise of groove!",
        "rating": {
          "rating": 4.1,
          "votesCount": 1234,
          "rankingSort": 2.3
        },
        "category": {
          "id": 2,
          "category": "MIX",
          "imageUrl": "https://yourdomain.perfectgym.pl/Api/Files/Photo?xxxxxxxxx",
          "isDeleted": false,
          "isProductRequiredForBooking": false,
          "name": "Mix",
          "timestamp": 1223165441
        }
      },
      "instructor": {
        "id": 52,
        "timestamp": 376826,
        "firstName": "Agatha",
        "lastName": "Strickland",
        "displayName": "Agatha Strickland",
        "email": "a.strickland@cyberbotics.com",
        "photoUrl": "",
        "sex": "Female",
        "rating": {
          "rating": 4.7,
          "votesCount": 1234,
          "rankingSort": 3.3
        },
        "isActive": true,
        "isDeleted": false
      },
      "club": {
        "id": 2,
        "timestamp": 271990,
        "name": "Fibo Cyberbotics",
        "shortName": "Cyberbotics",
        "symbol": "FCBR",
        "type": "Normal",
        "openDate": "2015-01-01",
        "latitude": 52.51038,
        "longitude": 13.39763,
        "email": "club@cyberbotics.com",
        "phoneNumber": "+49 12 123 456 789",
        "timezone": "Central European Standard Time",
        "address": {
          "line1": "Leipziger Str. 46/47",
          "line2": "",
          "city": "Berlin",
          "postalCode": "10-117",
          "country": "Germany"
        },
        "isDeleted": false,
        "isHidden": false
      },
      "id": 1677,
      "timestamp": 254718,
      "isDeleted": false,
      "startDate": "2015-12-03T06:15:00",
      "endDate": "2015-12-03T07:15:00",
      "attendeesCount": 7,
      "attendeesLimit": 20,
      "clubZone": "Fitness"
    }
  ]
}

Example error response

Subsequent booking for class with id =1677 and for user with id = 40 generates following error:

Status: 400 Bad Request
{
  "errors": [
    {
      "code": "ClassAlreadyBooked",
      "property": "",
      "message": ""
    }
  ]
}

List of available seat numbers to book alt text alt text

GET Classes/AvailableSeatNumbers

Gets the list of available seat number to book.

Request parameters

Name Type Description
classId long Required. Class identifier. Request cancels user booking for fitness class identified by classId.

Response

Example request

In this example we request about booking available seat numbers for class with id = 1677

curl -i 
     -X GET 
     -H "Authorization: Bearer  $ACCESS_TOKEN"  
     http://yoursubdomain.perfectgym.com/Api/Classes/AvailableSeatNumbers
        ?classId=1677

Example response

Status: 200 OK
{
  "elements": [
    2,
    3,
    4,
    7,
    8
  ]
}

Execute class cancel alt text alt text

POST Classes/CancelBooking

Cancels user booking.

Employee mode parameters

Name Type Description
classId long Required. Class identifier. Request cancels user booking for fitness class identified by classId.
userId long Required. User identifier. Request cancels user identified by userId booking for fitness class.

User mode parameters

Name Type Description
classId long Required. Class identifier. Request cancels authenticated user booking for fitness class identified by classId.

Response

Class details if class cancel is successful, or collection of errors with class cancel error codes otherwise.

Employee mode example request

In this example we cancel booking of user with id = 40 for classes with id = 1677

curl -i 
     -X GET 
     -H "Authorization: Bearer  $ACCESS_TOKEN"  
     http://yoursubdomain.perfectgym.com/Api/Classes/CancelBooking
        ?classId=1677
        &userId=40

Example response

Status: 200 OK
{
  "elements": [
    {
      "booked": false,
      "attended": false,
      "standby": false,
      "userClassRating": "",
      "userInstructorRating": "",
      "classType": {
        "id": 1,
        "timestamp": 263952,
        "name": "Box",
        "photoUrl": "",
        "iconUrl": "",
        "description": "Box perfectly combines cardio and strength training under the guise of groove!",
        "rating": {
          "rating": 4.1,
          "votesCount": 1234,
          "rankingSort": 2.3
        },
        "category": {
          "id": 2,
          "category": "MIX",
          "imageUrl": "https://yourdomain.perfectgym.pl/Api/Files/Photo?xxxxxxxxx",
          "isDeleted": false,
          "isProductRequiredForBooking": false,
          "name": "Mix",
          "timestamp": 1223165441
        }
      },
      "instructor": {
        "id": 52,
        "timestamp": 376826,
        "firstName": "Agatha",
        "lastName": "Strickland",
        "displayName": "Agatha Strickland",
        "email": "a.strickland@cyberbotics.com",
        "photoUrl": "",
        "sex": "Female",
        "rating": {
          "rating": 4.7,
          "votesCount": 1234,
          "rankingSort": 3.3
        },
        "isActive": true,
        "isDeleted": false
      },
      "club": {
        "id": 2,
        "timestamp": 271990,
        "name": "Fibo Cyberbotics",
        "shortName": "Cyberbotics",
        "symbol": "FCBR",
        "type": "Normal",
        "openDate": "2015-01-01",
        "latitude": 52.51038,
        "longitude": 13.39763,
        "email": "club@cyberbotics.com",
        "phoneNumber": "+49 12 123 456 789",
        "timezone": "Central European Standard Time",
        "address": {
          "line1": "Leipziger Str. 46/47",
          "line2": "",
          "city": "Berlin",
          "postalCode": "10-117",
          "country": "Germany"
        },
        "isDeleted": false,
        "isHidden": false
      },
      "id": 1677,
      "timestamp": 254718,
      "isDeleted": false,
      "startDate": "2015-12-03T06:15:00",
      "endDate": "2015-12-03T07:15:00",
      "attendeesCount": 6,
      "attendeesLimit": 20,
      "clubZone": "Fitness"
    }
  ]
}

Example error response

Subsequent cancel for class with id =1677 and for user with id = 40 generates following error:

Status: 400 Bad Request
{
  "errors": [
    {
      "code": "ClassNotBooked",
      "property": "",
      "message": ""
    }
  ]
}

Execute private training booking alt text

POST Classes/BookClass/PersonalTraining

Signs up user for fitness personal training.

User mode parameters

Name Type Description
title string Required. Reservation title.
startDate datetime Required. Reservation starting time.
endDate datetime Required. Reservation for a specific time .
clubId long Required. Club identifier.
employeeId long Required. Employee identifier. Employee leading personal training
description string Reservation comment
clubZoneId long Club zone identifier.
productId long Product identifier. Product bought by user, related to personal training

User mode example request

In this example we sign up user for personal training with specific employee id = 1677

curl -X POST 
     -H "Authorization: Bearer $ACCESS_TOKEN" 
     -H "Content-Type: application/json" 
     -d '{
        "title": "Reservation",
        "startDate": "2015-12-03T06:15:00",
        "endDate": "2015-12-03T08:15:00",
        "clubId": 1,
        "employeeId": "1677",
        "clubZoneId": 12            
    }' 
    http://yoursubdomain.perfectgym.com/Api/Classes/BookClass/PersonalTraining

Example response

Status: 200 OK
{
  "elements": [
    {
      "id": "1324465",
      "name": "Reservation",
      "startDate": "2015-12-03T06:15:00",
      "endDate": "2015-12-03T08:15:00",
      "comments": "null",
      "clubId": "12",
      "employeeId": "1677",
      "clubZoneId": "null",
      "productId": "null",
      "userId": "1",
      "isCompleted": "false",
      "isCancelled": "false",
      "deliveries": "[]"
    }
  ]
}
Perfect Gym api