Account API functions
Flaviu Porutiu
Table of contents |
---|
Log in
Logs the user in using its credentials
POST /login
Request
Request | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Endpoint: /login | ||||||||||||||
Method: POST | ||||||||||||||
Only logged in: NO | ||||||||||||||
Account privilege restriction: No restriction | ||||||||||||||
Headers: Click here to expand...
| ||||||||||||||
Parameters: Click here to expand...
|
Response
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:
User data object:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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
Request | ||||||||
---|---|---|---|---|---|---|---|---|
Endpoint: /user | ||||||||
Method: GET | ||||||||
Only logged in: YES | ||||||||
Account privilege restriction: Any privilege | ||||||||
Headers: Click here to expand...
|
Response
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:
User_data object User_data object:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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
Request | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
Endpoint: /user/email | ||||||||||
Method: POST | ||||||||||
Only logged in: YES | ||||||||||
Account privilege restriction: Any privilege | ||||||||||
Headers: Click here to expand...
| ||||||||||
Parameters: Click here to expand...
|
Response
Response | ||||||
Http Code | Response | Description | ||||
---|---|---|---|---|---|---|
200 | Success response Success response { "success": 1 } | Success response Object Description Base object:
| ||||
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
Request | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
Endpoint: /user/address | ||||||||||
Method: POST | ||||||||||
Only logged in: YES | ||||||||||
Account privilege restriction: Any privilege | ||||||||||
Headers: Click here to expand...
| ||||||||||
Parameters: Click here to expand...
|
Response
Response | ||||||
Http Code | Response | Description | ||||
---|---|---|---|---|---|---|
200 | Success response Success response { "success": 1 } | Success response Object Description Base object:
| ||||
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
Request | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
Endpoint: /user/phone | ||||||||||
Method: POST | ||||||||||
Only logged in: YES | ||||||||||
Account privilege restriction: Any privilege | ||||||||||
Headers: Click here to expand...
| ||||||||||
Parameters: Click here to expand...
|
Response
Response | ||||||
Http Code | Response | Description | ||||
---|---|---|---|---|---|---|
200 | Success response Success response { "success": 1 } | Success response Object Description Base object:
| ||||
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
Request | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Endpoint: /user/password | ||||||||||||||
Method: POST | ||||||||||||||
Only logged in: YES | ||||||||||||||
Account privilege restriction: Any privilege | ||||||||||||||
Headers: Click here to expand...
| ||||||||||||||
Parameters: Click here to expand...
|
Response
Response | ||||||
Http Code | Response | Description | ||||
---|---|---|---|---|---|---|
200 | Success response Success response { "success": 1 } | Success response Object Description Base object:
| ||||
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
Request | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
Endpoint: /user/id_card | ||||||||||
Method: POST | ||||||||||
Only logged in: YES | ||||||||||
Account privilege restriction: Any privilege | ||||||||||
Headers: Click here to expand...
| ||||||||||
Parameters: Click here to expand...
|
Response
Response | ||||||||
Http Code | Response | Description | ||||||
---|---|---|---|---|---|---|---|---|
200 | Success response Success response { "success": 1, "key": 1300 } | Success response Object Description Base object:
| ||||||
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
Request | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Endpoint: /reset_password | ||||||||||||||
Method: POST | ||||||||||||||
Only logged in: NO | ||||||||||||||
Account privilege restriction: No restriction | ||||||||||||||
Headers: Click here to expand...
| ||||||||||||||
Parameters: Click here to expand...
|
Response
Response | ||||||
Http Code | Response | Description | ||||
---|---|---|---|---|---|---|
200 | Success response Success response { "success": 1 } | Success response Object Description Base object:
| ||||
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
Request | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Endpoint: /reset_password_change | ||||||||||||||||||
Method: POST | ||||||||||||||||||
Only logged in: NO | ||||||||||||||||||
Account privilege restriction: No restriction | ||||||||||||||||||
Headers: Click here to expand...
| ||||||||||||||||||
Parameters: Click here to expand...
|
Response
Response | ||||||
Http Code | Response | Description | ||||
---|---|---|---|---|---|---|
200 | Success response Success response { "success": 1 } | Success response Object Description Base object:
| ||||
403 | Forbidden | User cannot access the resource | ||||
422 | Click here to expand... Error response { "message": "The given data was invalid.", "errors": { ... } } | Error |