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

User contracts

This API lets you list, assign and delete user contracts.

Add user and assign contractalt text

POST Users/UserContract

Request assigns new contract to new club user.

Body parameters

Name Type Description
paymentPlanId string Required. Payment plan identifier. Request creates new contract based on payment plan identified by paymentPlanId
startDate string Required. Contract start date.
signDate string Required. Contract sign date.
discountIds array Array of discount identifiers to be applied to contract.
email string Required. User email address.
homeClubId long Required. User home club identifier.
birthDate string Required. User birth date.
personalId string User personal identifier.
firstName string User first name.
lastName string User last name.
phoneNumber string User phone number.
idCardName string User identity card name.
idCardNumber string User identity card number.
legalGuardian LegalGuardian User legal guardian.
isForeigner bool Indicates if user is a forigner.
isPaidByDifferentPerson bool Indicates if contract is paid by other person.
sex string User sex.
Possible values:
  • Male
  • Female
address Address User address.
directDebit DirectDebit Direct debit.
additionalContracts array Array of Contracts body parameters objects.

Response

User details with contract detailed description.

Example request

In this example we create new contract based on payment plan with id = 44. Also discount with id = 10 is applied.


curl -X POST 
     -H "Authorization: Bearer $ACCESS_TOKEN" 
     -H "Content-Type: application/json" 
     -d '{
        "paymentPlanId": 44,
        "startDate": "2016-01-26T00:00:00",
        "signDate": "2016-01-26T00:00:00",
        "discountIds": [10],
        "firstName": "John",
        "lastName": "Fibo",
        "email": "john.fibo@perfectgym.pl",
        "phoneNumber": "0048123456789",
        "idCardName": "Passport",
        "idCardNumber": "ABC 123456",
        "legalGuardian": "",
        "birthDate": "1978-06-01T00:00:00",
        "isForeigner": false,
        "sex": "Male",
        "homeClubId": 12,
        "address": {
            "line1": "al. Jerozolimskie 114",
            "line2": "",
            "city": "Warszawa",
            "postalCode": "20-259",
            "country": "Poland"
        }       
    }' 
    http://yoursubdomain.perfectgym.com/Api/Users/UserContract

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": "",
      "coverPhotoUrl": "",
      "birthDate": "1978-06-01T00:00:00",
      "isForeigner": false,
      "sex": "Male",
      "newsletterAgreement": false,
      "termsAndConditionsAgreement": false,
      "address": {
        "country": "Poland",
        "city": "Warszawa",
        "postalCode": "02-962",
        "line1": "ul. Przyczolkowa 334",
        "line2": ""
      },
      "directDebit": {
        "accountNumber": "",
        "ownerName": "",
        "street": "",
        "cityAndPostalCode": "",
        "documentUrl": ""
      },
      "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": "",
          "isActive": true,
          "isDeleted": false
        }
      ]
    }
  ]
}

Assign contract to a club user alt text

POST Users/Contract

Request assigns new contract to existing club user.

Parameters

Name Type Description
userId long Required. User identifier. Request assigns new contract to user identified by userId.

Body parameters

Name Type Description
paymentPlanId string Required. Payment plan identifier. Request creates new contract based on payment plan identified by paymentPlanId
startDate string Required. Contract start date.
signDate string Required. Contract sign date.
discountIds array Array of discount identifiers to be applied to contract.

Response

User details with contract detailed description.

Example request

In this example we create new contract based on payment plan with id = 44 and we assigne it to user with id of value 236. Also discount with id = 10 is applied.


curl -X POST 
     -H "Authorization: Bearer $ACCESS_TOKEN" 
     -H "Content-Type: application/json" 
     -d '{
        "paymentPlanId": 44,
        "startDate": "2016-01-26T00:00:00",
        "signDate": "2016-01-26T00:00:00",
        "discountIds": [10]     
    }' 
    http://yoursubdomain.perfectgym.com/Api/Users/Contract?userId=236

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": "",
      "coverPhotoUrl": "",
      "birthDate": "1978-06-01T00:00:00",
      "isForeigner": false,
      "sex": "Male",
      "newsletterAgreement": false,
      "termsAndConditionsAgreement": false,
      "address": {
        "country": "Poland",
        "city": "Warszawa",
        "postalCode": "02-962",
        "line1": "ul. Przyczolkowa 334",
        "line2": ""
      },
      "directDebit": {
        "accountNumber": "",
        "ownerName": "",
        "street": "",
        "cityAndPostalCode": "",
        "documentUrl": ""
      },
      "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": "",
          "isActive": true,
          "isDeleted": false
        }
      ]
    }
  ]
}

Delete user contract alt text

DELETE Users/Contract

Request deletes user contract.

Parameters

Name Type Description
userId long Required. User identifier.
contractId long Required. Contract identifier. Request deletes user contract identified by contractId.

Response

User details.

Example request

In this example we delete user contract with id = 10358


curl -X DELETE 
     -H "Authorization: Bearer $ACCESS_TOKEN" 
     -H "Content-Type: application/json"     
    http://yoursubdomain.perfectgym.com/Api/Users/Contract?userId=236&contractId=10358

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": false,
      "address": {
        "country": "Poland",
        "city": "Warszawa",
        "postalCode": "02-962",
        "line1": "ul. Przyczolkowa 334",
        "line2": ""
      },
      "directDebit": {
        "accountNumber": "",
        "ownerName": "",
        "street": "",
        "cityAndPostalCode": "",
        "documentUrl": ""
      },
      "homeClubId": 12,
      "registeredAtClubId": "",
      "isActive": true,
      "isDeleted": false,
      "contracts": [

      ]
    }
  ]
}

Execute contract signing alt text

POST Users/SignContract

Request is used to sign contract PDF document with a user signature.

Body parameters

Name Type Description
contractId long Contract unique identifier.
languageCode string Language identifier contract should be translated to (for example EN, DE etc.).
signatureData string Signature data base64 encoded.
sourceIp string IP address of client user signs contract on.
comment string Contract signing comment

Response

User details including signed contract URL.

Example request

In this example we sign direct debit agreement for user with id = 236.


curl -X POST 
     -H "Authorization: Bearer $ACCESS_TOKEN" 
     -H "Content-Type: application/json" 
     -d '{
        "contractId": "10358",
        "languageCode": "EN",
        "signatureData": "... signature data ...",      
        "sourceIp": "192.168.1.100",
        "comment": "Sample comment"
    }' 
    http://yoursubdomain.perfectgym.com/Api/Users/SignContract

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": "",
      "coverPhotoUrl": "",
      "birthDate": "1978-06-01T00:00:00",
      "isForeigner": false,
      "sex": "Male",
      "newsletterAgreement": false,
      "termsAndConditionsAgreement": false,
      "address": {
        "country": "Poland",
        "city": "Warszawa",
        "postalCode": "02-962",
        "line1": "ul. Przyczolkowa 334",
        "line2": ""
      },
      "directDebit": {
        "accountNumber": "",
        "ownerName": "",
        "street": "",
        "cityAndPostalCode": "",
        "documentUrl": ""
      },
      "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