Account API functions


Table of contents




Log in

Logs the user in using its credentials

POST /login

Request

 Click here to expand...


Request

Endpoint: /login

Method: POST

Only logged in: NO

Account privilege restriction: No restriction

Headers:

 Click here to expand...
Header nameValue
X-Requested-With
XMLHttpRequest

Parameters:

 Click here to expand...
ParameterRequiredTypeDescription
username
YES
StringUsername or email of the user
passwordYESStringPassword of the account

Response

 Click here to expand...


Response

Http Code

Response

Description

200

 Success response
Success response
 {
    "success": 1,
    "message": "xxxxxxxx-1111-2222-3333-xxxxxxxxxxxx",
    "user_data": {
        "id": 4,
        "full_name": "John Doe",
        "username": "johndoe",
        "date_of_birth": "1988-12-05",
        "email": "johndoe@glitch.ro",
        "address": "-",
        "phone": "0700000000",
        "privilege": 5,
        "locale": "ro",
        "activation_token": null,
        "id_card_number": "1234",
        "club_id": null,
        "strikes": 2,
        "locked": null,
        "eula_accepted": "2018-05-17 18:01:04",
        "created_at": "2017-12-06 17:28:02",
        "updated_at": "2018-05-17 18:01:04",
        "banned_at": null,
        "sex": 1,
        "unique_number": "-",
        "id_document_serie": "-",
        "id_document_number": "-",
        "account_creation_by": 1,
        "trainer_id": 10,
        "is_trainer": 0,
		"has_scale_active": true
    }
}
 Error response
Success response
{
    "success": 0,
    "message": "Username / password invalid!"
}

Success response

 Object Description

Base object:

Object propertyDescription
successRepresents if the login was successful
messageLogin token used for logged in API calls / error message
user_dataUser data object

User data object:

Object propertyDescription
idInternal ID of the user
full_nameUser full name
usernameUser username
date_of_birthUser date of birth (Y-m-d format)
emailUser email
addressUser address
phoneUser phone number
privilege

User privilege:

  • 1 - Root
  • 2 - Club manager
  • 3 - Administrator / reception
  • 4 - Trainer
  • 5 - Member
locale

User locale:

  • ro - Romanian
  • en - English
activation_tokenInternal usage - will ALWAYS be null
id_card_numberCheck-in number for gatekeeper
club_idUsed for club managers and administrators to indicate the club they belong to. Otherwise it will be null
strikesHow many no shows it has at that moment that will be counted towards ban
lockedIndicates if the account was banned or not - will always be null
eula_acceptedIndicates the date and time when the user accepted the license agreement.
created_atDate and time when the user was created at
updated_atDate and time when the user was last updated at
banned_atDate and time when the user was banned due to too many no-shows. Null if not banned.
sex

User sex:

  • 1 - Male
  • 2 - Female
  • 3 - Other
unique_numberUser ID number from personal citizenship ID card
id_document_serieUser personal citizenship ID card document serie
id_document_numberUser personal citizenship ID card document number
account_creation_by

The way the account was created:

  • 1 - Admin
  • 2 - Self signup
  • 3 - Invite
  • 4 - CSV Import
trainer_idTrainer assigned to the user
is_trainerIndicates if the user is a trainer (used to override manager and admin privilege in case they are also trainers)
has_scale_active

Indicates if the current user has an active scale / survey.

If true, the Get scale endpoint should be called.


422

 Click here to expand...
Error response
{
  "success": 0
}

Error



Get user data

Returns user data of the logged in user..

GET /user

Account privilege restriction: Any logged in account

Request

 Click here to expand...


Request

Endpoint: /user

Method: GET

Only logged in: YES

Account privilege restriction: Any privilege

Headers:

 Click here to expand...
Header nameValue
X-Requested-With
XMLHttpRequest
X-Auth-TokenToken obtained from Login endpoint

Response

 Click here to expand...


Response

Http Code

Response

Description

200

 Success response
Success response
{
    "success": 1,
    "user_data": {
        "id": 4,
        "full_name": "John Deux",
        "username": "johnd",
        "date_of_birth": "2017-12-05",
        "email": "johndeux@acme.com",
        "address": "-",
        "phone": "0712345678",
        "privilege": 5,
        "locale": "ro",
        "id_card_number": "7194",
        "club_id": null,
        "strikes": 2,
        "locked": null,
        "eula_accepted": "2018-05-17 18:01:04",
        "created_at": "2017-12-06 17:28:02",
        "updated_at": "2018-05-17 18:33:07",
        "banned_at": null,
        "sex": 1,
        "unique_number": "-",
        "id_document_serie": "-",
        "id_document_number": "-",
        "account_creation_by": 1,
        "trainer_id": 10,
        "is_trainer": 0,
		"has_scale_active": true
    }
}

Success response

 Base Object

Base object:

Object propertyDescription
successRepresents if the call was successful
user_dataRepresents the user data
 User_data object

User_data object:

Object propertyDescription
idInternal ID of the user
full_nameFull name of the user
usernameUsername
date_of_birthDate of birth
EmailEmail
addressAddress of the user
phonePhone of the user
privilege

User privilege:

  • 1 - Root
  • 2 - Club manager
  • 3 - Club administrator / reception
  • 4 - Trainer
  • 5 - Member
localeUser current locale
id_card_numberUser unique card number (or gatekeeper key)
club_idUser for club manager / club administrator to see to which club he belongs to
strikesHow many no shows he has
lockedShows if the account is locked by an admin
eula_acceptedDate and time for when the user accepted the club license agreement
created_atDate and time for when the user was created
updated_atDate and time for when the user was last updated
banned_atDate and time for when the user was banned for noshows
sex

Gender of the user

  • 1 - Male
  • 2 - Female
  • 3 - Other
unique_numberUser unique citizenship / passport number
id_document_serieUser unique citizenship / passport document serie
id_document_numberUser unique citizenship / passport document number
account_creation_by

Shows by whom the account was created:

  • 1 - Admin
  • 2 - Self signup
  • 3 - Invite
  • 4 - CSV import
trainer_idThe ID of the trainer which is assigned to him
is_trainerFlag showing if the user has access to trainer tools or not
has_scale_active

Indicates if the current user has an active scale / survey.

If true, the Get scale endpoint should be called.

403

Forbidden
User cannot access the resource


Change email address

Changes the logged in users' email address

POST /user/email

Account privilege restriction: Any logged in account

Request

 Click here to expand...


Request

Endpoint: /user/email

Method: POST

Only logged in: YES

Account privilege restriction: Any privilege

Headers:

 Click here to expand...
Header nameValue
X-Requested-With
XMLHttpRequest
X-Auth-TokenToken obtained from Login endpoint

Parameters:

 Click here to expand...
ParameterRequiredTypeDescription
email
YES
StringNew email

Response

 Click here to expand...


Response

Http Code

Response

Description

200

 Success response
Success response
{
    "success": 1
}

Success response

 Object Description

Base object:

Object propertyDescription
successRepresents if the call was successful

403

Forbidden
User cannot access the resource

422

 Click here to expand...
Error response
{
    "message": "The given data was invalid.",
    "errors": {
        "email": [
            "The email has already been taken."
        ]
    }
}

Error



Change address

Changes the logged in users' address

POST /user/address

Account privilege restriction: Any logged in account

Request

 Click here to expand...


Request

Endpoint: /user/address

Method: POST

Only logged in: YES

Account privilege restriction: Any privilege

Headers:

 Click here to expand...
Header nameValue
X-Requested-With
XMLHttpRequest
X-Auth-TokenToken obtained from Login endpoint

Parameters:

 Click here to expand...
ParameterRequiredTypeDescription
address
YES
StringNew address

Response

 Click here to expand...


Response

Http Code

Response

Description

200

 Success response
Success response
{
    "success": 1
}

Success response

 Object Description

Base object:

Object propertyDescription
successRepresents if the call was successful

403

Forbidden
User cannot access the resource

422

 Click here to expand...
Error response
{
    "message": "The given data was invalid.",
    "errors": {
        ...
    }
}

Error



Change phone number

Changes the logged in users' phone number

POST /user/phone

Account privilege restriction: Any logged in account

Request

 Click here to expand...


Request

Endpoint: /user/phone

Method: POST

Only logged in: YES

Account privilege restriction: Any privilege

Headers:

 Click here to expand...
Header nameValue
X-Requested-With
XMLHttpRequest
X-Auth-TokenToken obtained from Login endpoint

Parameters:

 Click here to expand...
ParameterRequiredTypeDescription
phone
YES
StringNew phone number

Response

 Click here to expand...


Response

Http Code

Response

Description

200

 Success response
Success response
{
    "success": 1
}

Success response

 Object Description

Base object:

Object propertyDescription
successRepresents if the call was successful

403

Forbidden
User cannot access the resource

422

 Click here to expand...
Error response
{
    "message": "The given data was invalid.",
    "errors": {
        ...
    }
}

Error



Change password

Changes the logged in users' phone number

POST /user/password

Account privilege restriction: Any logged in account

Request

 Click here to expand...


Request

Endpoint: /user/password

Method: POST

Only logged in: YES

Account privilege restriction: Any privilege

Headers:

 Click here to expand...
Header nameValue
X-Requested-With
XMLHttpRequest
X-Auth-TokenToken obtained from Login endpoint

Parameters:

 Click here to expand...
ParameterRequiredTypeDescription
password
YES
StringNew password
password_confirmationYESStringNew password confirmation

Response

 Click here to expand...


Response

Http Code

Response

Description

200

 Success response
Success response
{
    "success": 1
}

Success response

 Object Description

Base object:

Object propertyDescription
successRepresents if the call was successful

403

Forbidden
User cannot access the resource

422

 Click here to expand...
Error response
{
    "message": "The given data was invalid.",
    "errors": {
        ...
    }
}

Error



Change user check-in key

Changes the users check-in key with a new randomly generated one.

Gatekeeper enabled instances, only!

POST /user/id_card

Account privilege restriction: Any logged in account

Request

 Click here to expand...


Request

Endpoint: /user/id_card

Method: POST

Only logged in: YES

Account privilege restriction: Any privilege

Headers:

 Click here to expand...
Header nameValue
X-Requested-With
XMLHttpRequest
X-Auth-TokenToken obtained from Login endpoint

Parameters:

 Click here to expand...
ParameterRequiredTypeDescription
id
YES
Integer

ID of the user for which to change the ID card number

This parameter is only taken into account if the current user is admin or above

Response

 Click here to expand...


Response

Http Code

Response

Description

200

 Success response
Success response
{
    "success": 1,
    "key": 1300
}

Success response

 Object Description

Base object:

Object propertyDescription
successRepresents if the call was successful
keyRepresents the new check-in key

200

 Error response
Success response
{
    "success": 0
}
The instance is not Gatekeeper enabled

403

Forbidden
User cannot access the resource

422

 Click here to expand...
Error response
{
    "message": "The given data was invalid.",
    "errors": {
        ...
    }
}

Error



Reset password

Sends the reset password link to the user email

POST /reset_password

Request

 Click here to expand...


Request

Endpoint: /reset_password

Method: POST

Only logged in: NO

Account privilege restriction: No restriction

Headers:

 Click here to expand...
Header nameValue
X-Requested-With
XMLHttpRequest

Parameters:

 Click here to expand...
ParameterRequiredTypeDescription
email
YES
StringUser registered email
site_integrationNOInteger

Sets if the link sent to reset the password should be on the gym's site or not.

Possible values:

  • 0 - Normal email
  • 1 - Email link sends to personalized web page on gym website


The link to the custom page can be set by the root privileged user in the application settings page under the integrations tab.

Response

 Click here to expand...


Response

Http Code

Response

Description

200

 Success response
Success response
{
    "success": 1
}

Success response

 Object Description

Base object:

Object propertyDescription
successRepresents if the call was successful

403

Forbidden
User cannot access the resource

422

 Click here to expand...
Error response
{
    "message": "The given data was invalid.",
    "errors": {
        ...
    }
}

Error



Reset password change (via token)

Changes the user password via the token gotten from email

POST /reset_password_change

Request

 Click here to expand...


Request

Endpoint: /reset_password_change

Method: POST

Only logged in: NO

Account privilege restriction: No restriction

Headers:

 Click here to expand...
Header nameValue
X-Requested-With
XMLHttpRequest

Parameters:

 Click here to expand...
ParameterRequiredTypeDescription
key
YES
StringToken got via email
passwordYESStringNew password
password_confirmationYESStringNew password confirmation

Response

 Click here to expand...


Response

Http Code

Response

Description

200

 Success response
Success response
{
    "success": 1
}

Success response

 Object Description

Base object:

Object propertyDescription
successRepresents if the call was successful

403

Forbidden
User cannot access the resource

422

 Click here to expand...
Error response
{
    "message": "The given data was invalid.",
    "errors": {
        ...
    }
}

Error