Perfect Gym api

User membership card

This API lets you assign membership card to a club user.

Membership card properties

User membership card is described by the following properties

Name Type Description
cardNumber string Number of the card.
timestamp long Timestamp. Indicates when resource was last modified.
isBlocked bool Card is blocked.
isDeleted bool Card is deleted.
cardType string Type of the card: NormalCard, TemporaryCard.
contractId long The current contract identifier at the time of assigning the card.
assigneReason string The reason for assigning cards to the user. List of reasons

Reasons for assigning a membership card

Get all membership user cards alt text

GET Users/MembershipCards

Request all membership user cards.

Parameters

Name Type Description
userId long Required. User identifier.

Response

List of user membership cards.

Example request

In this example we want to get all cards of user with id = 777


curl -X GET
     -H "Authorization: Bearer $ACCESS_TOKEN" 
     -H "Content-Type: application/json" 
    http://yoursubdomain.perfectgym.com/Api/Users/MembershipCards?userId=777

Example response

Status: 200 OK
{
  "elements": [
    {
      "cardNumber": "3294239048",
      "timestamp": 350287,
      "isBlocked": false,
      "isDeleted": false,
      "cardType": "NormalCard",
      "contractId": 32,
      "assigneReason": "NotSpecified"
    },
    {
      "cardNumber": "3212339080",
      "timestamp": 350287,
      "isBlocked": true,
      "isDeleted": true,
      "cardType": "NormalCard",
      "contractId": 32,
      "assigneReason": "NotSpecified"
    }
  ]
}

Assign membership card to a club user alt text

POST Users/MembershipCard

Request assigns membership card to a club user.

Parameters

Name Type Description
userId long Required. User identifier. Request assigns membership card to user identified by userId.

Body parameters

Name Type Description
cardNumber string Membership card number.

Response

User details.

Example request

In this example we assign new membership card to a user with id = 777.


curl -X POST 
     -H "Authorization: Bearer $ACCESS_TOKEN" 
     -H "Content-Type: application/json" 
     -d '{
        "cardNumber": "123456789"       
    }' 
    http://yoursubdomain.perfectgym.com/Api/Users/MembershipCard?userId=777

Example response

Status: 200 OK
{
  "elements": [
    {
      "id": 236,
      "timestamp": 448035,
      "personalId": "80010101234",
      "number": "2b7b02df-08ae-4720-a3ce-a594bfc46d47",
      "cardNumber": "123456789",
      "firstName": "John",
      "lastName": "Fibo",
      "email": "john.fibo@perfectgym.pl",
      "emailAddressIsConfirmed": false,
      "phoneNumber": "0048123456789",
      "idCardName": "Passport",
      "idCardNumber": "ABC 123456",
      "legalGuardian": "",
      "photoUrl": "http://yoursubdomain.perfectgym.com/Api/Files/Photo?photoId=78",
      "coverPhotoUrl": "",
      "birthDate": "1978-06-01T00:00:00",
      "isForeigner": false,
      "sex": "Male",
      "newsletterAgreement": false,
      "termsAndConditionsAgreement": true,
      "address": {
        "country": "Poland",
        "city": "Warszawa",
        "postalCode": "02-962",
        "line1": "ul. Przyczolkowa 334",
        "line2": ""
      },
      "directDebit": {
        "accountNumber": "61 1090 1014 0000 0712 1981 2874",
        "ownerName": "John Fibo",
        "street": "Przyczółkowa 334",
        "cityAndPostalCode": "02-962 Warszawa",
        "documentUrl": "http://yoursubdomain.perfectgym.com/Api/Files/Files?fileId=123"
      },
      "homeClubId": 12,
      "registeredAtClubId": "",
      "isActive": true,
      "isDeleted": false,
      "contracts": [
        {
          "id": 10358,
          "timestamp": 350287,
          "signUpDate": "2016-01-26T00:00:00",
          "startDate": "2016-01-26T00:00:00",
          "cancelDate": "",
          "endDate": "",
          "isCurrent": true,
          "membership": {
            "id": 1,
            "timestamp": 349423,
            "name": "Open",
            "isActive": true,
            "isDeleted": false
          },
          "paymentPlan": {
            "id": 44,
            "timestamp": 447623,
            "name": "Open 24m",
            "isActive": true,
            "isAddOnPaymentPlan": false,
            "isDeleted": false
          },
          "discounts": [
            {
              "id": 10,
              "isActive": true,
              "name": "50%",
              "administartionFeeDiscountType": "ValueDiscount",
              "joiningFeeDiscountType": "None",
              "membershipFeeDiscountType": "PercentDiscount",
              "administartionFeeDiscountValue": 0,
              "joiningFeeDiscountValue": "",
              "membershipFeeDiscountValue": 50
            }
          ],
          "documentUrl": "http://yoursubdomain.perfectgym.com/Api/Files/Files?fileId=120",
          "isActive": true,
          "isDeleted": false
        }
      ]
    }
  ]
}

Detach membership card from club user alt text

POST Users/DetachMembershipCard

Parameters

Name Type Description
userId long Required. User identifier. Request detach membership card to user identified by userId.

Body parameters

Name Type Description
cardNumber string Membership card number.

Response

User details.

Example request

In this example we detach membership card number 123456789 from a user with id = 777.


curl -X POST 
     -H "Authorization: Bearer $ACCESS_TOKEN" 
     -H "Content-Type: application/json" 
     -d '{
        "cardNumber": "123456789"       
    }' 
    http://yoursubdomain.perfectgym.com/Api/Users/MembershipCard?userId=777

Example response

Status: 200 OK
{
  "elements": [
    {
      "id": 236,
      "timestamp": 448035,
      "personalId": "80010101234",
      "number": "2b7b02df-08ae-4720-a3ce-a594bfc46d47",
      "cardNumber": "123456789",
      "firstName": "John",
      "lastName": "Fibo",
      "email": "john.fibo@perfectgym.pl",
      "emailAddressIsConfirmed": false,
      "phoneNumber": "0048123456789",
      "idCardName": "Passport",
      "idCardNumber": "ABC 123456",
      "legalGuardian": "",
      "photoUrl": "http://yoursubdomain.perfectgym.com/Api/Files/Photo?photoId=78",
      "coverPhotoUrl": "",
      "birthDate": "1978-06-01T00:00:00",
      "isForeigner": false,
      "sex": "Male",
      "newsletterAgreement": false,
      "termsAndConditionsAgreement": true,
      "address": {
        "country": "Poland",
        "city": "Warszawa",
        "postalCode": "02-962",
        "line1": "ul. Przyczolkowa 334",
        "line2": ""
      },
      "directDebit": {
        "accountNumber": "61 1090 1014 0000 0712 1981 2874",
        "ownerName": "John Fibo",
        "street": "Przyczółkowa 334",
        "cityAndPostalCode": "02-962 Warszawa",
        "documentUrl": "http://yoursubdomain.perfectgym.com/Api/Files/Files?fileId=123"
      },
      "homeClubId": 12,
      "registeredAtClubId": "",
      "isActive": true,
      "isDeleted": false,
      "contracts": [
        {
          "id": 10358,
          "timestamp": 350287,
          "signUpDate": "2016-01-26T00:00:00",
          "startDate": "2016-01-26T00:00:00",
          "cancelDate": "",
          "endDate": "",
          "isCurrent": true,
          "membership": {
            "id": 1,
            "timestamp": 349423,
            "name": "Open",
            "isActive": true,
            "isDeleted": false
          },
          "paymentPlan": {
            "id": 44,
            "timestamp": 447623,
            "name": "Open 24m",
            "isActive": true,
            "isAddOnPaymentPlan": false,
            "isDeleted": false
          },
          "discounts": [
            {
              "id": 10,
              "isActive": true,
              "name": "50%",
              "administartionFeeDiscountType": "ValueDiscount",
              "joiningFeeDiscountType": "None",
              "membershipFeeDiscountType": "PercentDiscount",
              "administartionFeeDiscountValue": 0,
              "joiningFeeDiscountValue": "",
              "membershipFeeDiscountValue": 50
            }
          ],
          "documentUrl": "http://yoursubdomain.perfectgym.com/Api/Files/Files?fileId=120",
          "isActive": true,
          "isDeleted": false
        }
      ]
    }
  ]
}

Block card alt text

PUT Users/Card/Block

Request blocks users card.

Parameters

Name Type Description
carNumber string Optional. States which of users cards has to be blocked. If null, then the default card will be blocked.

Response

User details.

Example request


curl -X PUT 
     -H "Authorization: Bearer $ACCESS_TOKEN" 
     -H "Content-Type: application/json" 
     
    http://yoursubdomain.perfectgym.com/Api/Users/Card/Block

Example response

Status: 200 OK
{
  "elements": [
    {
      "id": 236,
      "timestamp": 448035,
      "personalId": "80010101234",
      "number": "2b7b02df-08ae-4720-a3ce-a594bfc46d47",
      "cardNumber": "",
      "firstName": "John",
      "lastName": "Fibo",
      "email": "john.fibo@perfectgym.pl",
      "emailAddressIsConfirmed": false,
      "phoneNumber": "0048123456789",
      "idCardName": "Passport",
      "idCardNumber": "ABC 123456",
      "legalGuardian": "",
      "photoUrl": "http://yoursubdomain.perfectgym.com/Api/Files/Photo?photoId=78",
      "coverPhotoUrl": "",
      "birthDate": "1978-06-01T00:00:00",
      "isForeigner": false,
      "sex": "Male",
      "newsletterAgreement": false,
      "termsAndConditionsAgreement": true,
      "address": {
        "country": "Poland",
        "city": "Warszawa",
        "postalCode": "02-962",
        "line1": "ul. Przyczolkowa 334",
        "line2": ""
      },
      "directDebit": {
        "accountNumber": "61 1090 1014 0000 0712 1981 2874",
        "ownerName": "John Fibo",
        "street": "Przyczółkowa 334",
        "cityAndPostalCode": "02-962 Warszawa",
        "documentUrl": "http://yoursubdomain.perfectgym.com/Api/Files/Files?fileId=123"
      },
      "homeClubId": 12,
      "registeredAtClubId": "",
      "isActive": true,
      "isDeleted": false,
      "contracts": [
        {
          "id": 10358,
          "timestamp": 350287,
          "signUpDate": "2016-01-26T00:00:00",
          "startDate": "2016-01-26T00:00:00",
          "cancelDate": "",
          "endDate": "",
          "isCurrent": true,
          "membership": {
            "id": 1,
            "timestamp": 349423,
            "name": "Open",
            "isActive": true,
            "isDeleted": false
          },
          "paymentPlan": {
            "id": 44,
            "timestamp": 447623,
            "name": "Open 24m",
            "isActive": true,
            "isAddOnPaymentPlan": false,
            "isDeleted": false
          },
          "discounts": [
            {
              "id": 10,
              "isActive": true,
              "name": "50%",
              "administartionFeeDiscountType": "ValueDiscount",
              "joiningFeeDiscountType": "None",
              "membershipFeeDiscountType": "PercentDiscount",
              "administartionFeeDiscountValue": 0,
              "joiningFeeDiscountValue": "",
              "membershipFeeDiscountValue": 50
            }
          ],
          "documentUrl": "http://yoursubdomain.perfectgym.com/Api/Files/Files?fileId=120",
          "isActive": true,
          "isDeleted": false
        }
      ]
    }
  ]
}

Unblock card alt text

PUT Users/Card/Unblock

Request will unblock the card.

Parameters

Name Type Description
carNumber string Optional. States which of users' cards has to be unblocked. If null than the most recently blocked card will be unblocked.

Response

User details.

Example request


curl -X PUT 
     -H "Authorization: Bearer $ACCESS_TOKEN" 
     -H "Content-Type: application/json" 
     
    http://yoursubdomain.perfectgym.com/Api/Users/Card/Unblock

Example response

Status: 200 OK
{
  "elements": [
    {
      "id": 236,
      "timestamp": 448035,
      "personalId": "80010101234",
      "number": "2b7b02df-08ae-4720-a3ce-a594bfc46d47",
      "cardNumber": "123456789",
      "firstName": "John",
      "lastName": "Fibo",
      "email": "john.fibo@perfectgym.pl",
      "emailAddressIsConfirmed": false,
      "phoneNumber": "0048123456789",
      "idCardName": "Passport",
      "idCardNumber": "ABC 123456",
      "legalGuardian": "",
      "photoUrl": "http://yoursubdomain.perfectgym.com/Api/Files/Photo?photoId=78",
      "coverPhotoUrl": "",
      "birthDate": "1978-06-01T00:00:00",
      "isForeigner": false,
      "sex": "Male",
      "newsletterAgreement": false,
      "termsAndConditionsAgreement": true,
      "address": {
        "country": "Poland",
        "city": "Warszawa",
        "postalCode": "02-962",
        "line1": "ul. Przyczolkowa 334",
        "line2": ""
      },
      "directDebit": {
        "accountNumber": "61 1090 1014 0000 0712 1981 2874",
        "ownerName": "John Fibo",
        "street": "Przyczółkowa 334",
        "cityAndPostalCode": "02-962 Warszawa",
        "documentUrl": "http://yoursubdomain.perfectgym.com/Api/Files/Files?fileId=123"
      },
      "homeClubId": 12,
      "registeredAtClubId": "",
      "isActive": true,
      "isDeleted": false,
      "contracts": [
        {
          "id": 10358,
          "timestamp": 350287,
          "signUpDate": "2016-01-26T00:00:00",
          "startDate": "2016-01-26T00:00:00",
          "cancelDate": "",
          "endDate": "",
          "isCurrent": true,
          "membership": {
            "id": 1,
            "timestamp": 349423,
            "name": "Open",
            "isActive": true,
            "isDeleted": false
          },
          "paymentPlan": {
            "id": 44,
            "timestamp": 447623,
            "name": "Open 24m",
            "isActive": true,
            "isAddOnPaymentPlan": false,
            "isDeleted": false
          },
          "discounts": [
            {
              "id": 10,
              "isActive": true,
              "name": "50%",
              "administartionFeeDiscountType": "ValueDiscount",
              "joiningFeeDiscountType": "None",
              "membershipFeeDiscountType": "PercentDiscount",
              "administartionFeeDiscountValue": 0,
              "joiningFeeDiscountValue": "",
              "membershipFeeDiscountValue": 50
            }
          ],
          "documentUrl": "http://yoursubdomain.perfectgym.com/Api/Files/Files?fileId=120",
          "isActive": true,
          "isDeleted": false
        }
      ]
    }
  ]
}
Perfect Gym api