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

Password updating and validation

This API lets you create user account, update user password and validate user's credentials. User can use it's username and password to login to API in end user mode using varions client web and mobile apps, including:

Sign up for end user account with email alt text

POST Users/SignUp

Request creates an end user account and returns password reset token. To complete sign up process user has to update account password using password reset method. After completing sign up process user credentials can be used to access API in end user mode.

Parameters

Name Type Description
email string Required. User email.

Response

Password reset token.

Example request

In this example we sign up for an account for user identified with given email address.


curl -X POST 
     -H "Authorization: Bearer $ACCESS_TOKEN" 
     -H "Content-Type: application/json"     
    http://yoursubdomain.perfectgym.com/Api/Users/SignUp?email=john.fibo@perfectgym.pl

Example response

Status: 200 OK
{
  "elements": [
    {
      "resetPasswordToken": "9c10cdf6-565d-47cf-a7af-d27e6f989df8"
    }
  ]
}

Sign up for end user account with Facebook alt text

POST Users/SignUpWithFacebook

Request creates an end user account and returns User details. User is identified with Facebook email address. After completing sign up process Facebook token can be used to access API in end user mode.

Parameters

Name Type Description
facebookToken string Required. Facebook token.

Response

User details.

Example request

In this example we sign up for an account for user identified with an email address based on Facebook token.


curl -X POST 
     -H "Authorization: Bearer $ACCESS_TOKEN" 
     -H "Content-Type: application/json"     
    http://yoursubdomain.perfectgym.com/Api/Users/SignUp?facebookToken=FACEBOOK_TOKEN

Example response

Status: 200 OK
{
  "elements": [
    {
      "id": 1,
      "timestamp": 447183,
      "personalId": "80010101234",
      "number": "102000001",
      "cardNumber": "",
      "firstName": "Jan",
      "lastName": "Nowak",
      "email": "nowak@example.com",
      "emailAddressIsConfirmed": false,
      "photoUrl": "",
      "coverPhotoUrl": "",
      "birthDate": "1944-09-17T00:00:00",
      "isForeigner": false,
      "sex": "Male",
      "phoneNumber": "0048123456789",
      "idCardName": "Passport",
      "idCardNumber": "ABC 123456",
      "legalGuardian": "",
      "newsletterAgreement": false,
      "termsAndConditionsAgreement": false,
      "address": {
        "country": "Poland",
        "city": "Warszawa",
        "postalCode": "20-259",
        "line1": "al. Jerozolimskie 114",
        "line2": ""
      },
      "directDebit": {
        "accountNumber": "",
        "ownerName": "",
        "street": "",
        "cityAndPostalCode": "",
        "documentUrl": ""
      },
      "homeClubId": 12,
      "registeredAtClubId": "",
      "isActive": true,
      "isDeleted": false,
      "contracts": [
        {
          "id": 10358,
          "timestamp": 350287,
          "signUpDate": "2014-03-28T00:00:00",
          "startDate": "2014-04-01T00:00:00",
          "cancelDate": "2015-03-31T23:59:59",
          "endDate": "2015-03-31T23:59:59",
          "isCurrent": false,
          "membership": {
            "id": 1,
            "timestamp": 349423,
            "name": "Open",
            "isActive": true,
            "isDeleted": false
          },
          "paymentPlan": {
            "id": 2,
            "timestamp": 252688,
            "name": "Student weekly 45",
            "isActive": true,
            "isDeleted": false
          },
          "discounts": [
            {
              "id": 10,
              "isActive": true,
              "name": "50%",
              "administartionFeeDiscountType": "ValueDiscount",
              "joiningFeeDiscountType": "None",
              "membershipFeeDiscountType": "PercentDiscount",
              "administartionFeeDiscountValue": 0,
              "joiningFeeDiscountValue": "",
              "membershipFeeDiscountValue": 50
            }
          ],
          "isActive": true,
          "isDeleted": false
        }
      ]
    }
  ]
}

Request password reset token alt text

GET Users/ResetPassword

Request returns password reset token. Using password reset token user is able to update his account password. For details see password reset method.

Parameters

Name Type Description
email string Required. User email.

Response

Password reset token.

Example request

In this example user's password reset token.


curl -X GET 
     -H "Authorization: Bearer $ACCESS_TOKEN" 
     -H "Content-Type: application/json" 
     http://yoursubdomain.perfectgym.com/Api/Users/ResetPassword?email=john.fibo@perfectgym.pl

Example response

Status: 200 OK
{
  "elements": [
    {
      "resetPasswordToken": "9c10cdf6-565d-47cf-a7af-d27e6f989df8"
    }
  ]
}

Password reset alt text

POST Users/ResetPassword

Request updates user account password. Prior to updating user account password, password reset token must be aquired.

Body parameters

Name Type Description
resetPasswordToken string Required. Password reset token.
password string Required. New user account password.

Response

User details.

Example request

In this example we update password for account with a given password reset token associated.


curl -X POST 
     -H "Authorization: Bearer $ACCESS_TOKEN" 
     -H "Content-Type: application/json"     
     -d '{
        "resetPasswordToken": "9c10cdf6-565d-47cf-a7af-d27e6f989df8",
        "password": "new_password"      
    }' 
    http://yoursubdomain.perfectgym.com/Api/Users/ResetPassword

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
        }
      ]
    }
  ]
}

Send email with link to page to reset password alt text

GET Users/SendEmailToResetPassword

Sending en email message with link to page to reset password. Link include token to reset password, which can be pass to ResetPassword method.

Parameters

Name Type Description
email string Required. User email.

Response

Returns Success when send an email message, otherwise, it return error code: "EmailTemplateNotDefined", "UnableSendEmail" or "InvalidToken".

Example request

In this example user's password reset token.


curl -X GET 
     -H "Authorization: Bearer $ACCESS_TOKEN" 
     -H "Content-Type: application/json" 
     http://yoursubdomain.perfectgym.com/Api/Users/SendEmailToResetPassword?email=john.fibo@perfectgym.pl

Example response

Status: 200 OK
{
  "elements": [
    {
      "ResultStatus": "Success"
    }
  ]
}

Example error response

Template of email message is not defined.

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

Error during sending email message.

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

Error during creating reset password token token.

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

Validate user credentials alt text

POST Users/ValidateCredentials

Request checks if user's name and password are valid.

Body parameters

Name Type Description
userName string User name.
password string User password.

Response

User details if operation is successful, or collection of errors with validate credentials error codes otherwise.

Example request

In this example we validate user credentials.


curl -X POST 
     -H "Authorization: Bearer $ACCESS_TOKEN" 
     -H "Content-Type: application/json" 
     -d '{
        "userName": "john.fibo@perfectgym.pl",
        "password": "password",     
    }' 
    http://yoursubdomain.perfectgym.com/Api/Users/ValidateCredentials

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
        }
      ]
    }
  ]
}

Example error response

Invalid user credentials generates following response:

Status: 400 Bad Request
{
  "errors": [
    {
      "code": "InvalidUserNameOrPassword",
      "property": "",
      "message": ""
    }
  ]
}
Perfect Gym api