Registration and Authentication

For Application developers if you wish to provide user access to the Channex interface via API. Methods for user sign up, login and password reset.

Sign Up

Register a new user in the system.

Request
Success Response
Error Response

Request:

POST https://staging.channex.io/api/v1/sign_up

Query body (JSON):

{
"user" : {
"email": "user@channex.io",
"name": "Channex User",
"password": "password",
"password_confirmation": "password"
}
}

Success Response Example

Status Code: 200 OK

{
"meta": {
"message": "You are successfully logged in! Add this token to authorization header to make authorized requests."
},
"data": {
"type": "session",
"attributes": {
"token": "AUTH_TOKEN"
},
"relationships": {
"user": {
"data": {
"type": "user",
"id": "2cd26047-db52-4c54-8c28-98099021c480",
"attributes": {
"id": "2cd26047-db52-4c54-8c28-98099021c480",
"email": "user@channex.io",
"name": "Channex User",
"system_role": "user"
}
}
}
}
}
}

Validation Error Response

Status Code: 422 Unprocessable Entity

{
"errors": {
"code": "validation_error",
"title": "Validation Error",
"details": {
"email": [
"has already been taken"
]
}
}
}

Method requires a valid User Registration object as incoming argument represented as type user.

Fields

email [required] String with a valid email address. Note: User will use this email address to login into the system.

name [required] Any non-empty string with maximum length of 50 symbols. Note: The user will be represented in the system under that name.

password [required] Non empty string with at least 8 symbols of length. Any symbols are allowed. (Required Field) Note: User will use this password to login into the system.

password_confirmation [required] Non empty string with at least 8 symbols of length. Should be equal to password field value.

Note: Please check password confirmation as we will throw a validation error if password does not match.

Returns

Success Method can return a Success result with 200 OK HTTP Code if operation is successful. Will contain a Session object in the answer. Validation Error Method can return a Validation Error result with 422 Unprocessable Entity HTTP Code if any validation rule is failed.

Sign In

Authenticate a user at the system.

Request
Success Response
Error Response

Request:

POST https://staging.channex.io/api/v1/sign_in

Query body (JSON):

{
"user" : {
"email": "user@channex.io",
"password": "password",
}
}

Success Response Example

Status Code: 200 OK

{
"meta": {
"message": "You are successfully logged in! Add this token to authorization header to make authorized requests."
},
"data": {
"type": "session",
"attributes": {
"token": "AUTH_TOKEN"
},
"relationships": {
"user": {
"data": {
"type": "user",
"id": "2cd26047-db52-4c54-8c28-98099021c480",
"attributes": {
"id": "2cd26047-db52-4c54-8c28-98099021c480",
"email": "user@channex.io",
"name": "Channex User",
"system_role": "user"
}
}
}
}
}
}

Unauthorised Error Response

Status Code: 401 Unauthorized

{
"errors": {
"code": "unauthorized",
"title": "Unauthorized"
}
}

Method requires a valid User Authentication object as incoming argument represented as type user.

Fields

email [required] String with a valid email address.

password [required] Non empty string with at least 8 symbols of length. Any symbols are allowed.

Returns

Success Method can return a Success result with 200 OK HTTP Code if operation is successful. Will contain a Session object in the answer. Unauthorised Error Method can return Unauthorised Error result with 401 Unauthorized HTTP Code if email or password is not valid. By security reason, if provided email is not represented at system we will return a Unauthorised error also.

Request Restore Password Instructions

Request sending restore password instructions to user email.

Request
Success Response

Request:

POST https://staging.channex.io/api/v1/request_restore_password

Query body (JSON):

{
"user" : {
"email": "user@channex.io"
}
}

Success Response Example

Status Code: 200 OK

{
"meta": {
"message": "Instructions to restore password was send successfully!"
}
}

Method require valid User object as incoming argument represented as type user.

Fields

email [required] String with valid email address.

Returns

Success Method can return Success result with 200 OK HTTP Code if operation is successful. Will contain meta object with message. For security reasons this method will return Success result for each request.

Restore Password

Set new user password

Request
Success Response
Error Response

Request:

POST https://staging.channex.io/api/v1/restore_password

Query body (JSON):

{
"user": {
"restore_password_token": "RESTORE_TOKEN",
"password": "password",
"password_confirmation": "password"
}
}

Success Response Example

Status Code: 200 OK

{
"meta": {
"message": "Password was restored!"
}
}

Bad Request Error Response

Status Code: 400 Bad Request

{
"errors": {
"code": "bad_request",
"title": "Bad Request"
}
}

Validation Error Response

Status Code: 422 Unprocessable Entity

{
"errors": {
"code": "validation_error",
"title": "Validation Error",
"details": {
"password_confirmation": [
"does not match confirmation"
]
}
}
}

Method requires a valid User object as incoming argument represented as type user.

Fields

restore_password_token [required] String value. restore_password_token will be sent via email when user calls Request Restore Password Instructions.

password [required] Non empty string with at least 8 symbols of length. Any symbols is allowed. User will use this password to login into the system.

password_confirmation [required] Non empty string with at least 8 symbols of length. Should be equal to password field value.

Returns

Success Method can return Success result with 200 OK HTTP Code if operation is successful. Will contain meta object with message.

Bad Request Error Method can return a Bad Request Error result with 400 Bad Request HTTP Code if restore_password_token is invalid.

Validation Error Method can return Validation Error result with 422 Unprocessable Entity HTTP Code if any validation rule is failed.

Confirm Registration

Confirm user registration by sending a token to the users email address and validating it is a valid email address.

Request
Success Response
Error Response

Request:

GET https://staging.channex.io/api/v1/confirm_registration?token=TOKEN

Success Response Example

Status Code: 200 OK

{
"meta": {
"message": "You are successfully confirm your account! Right now you are logged in. Add this token to authorization header to make authorized requests."
},
"data": {
"type": "session",
"attributes": {
"token": "AUTH_TOKEN"
},
"relationships": {
"user": {
"data": {
"type": "user",
"id": "2cd26047-db52-4c54-8c28-98099021c480",
"attributes": {
"id": "2cd26047-db52-4c54-8c28-98099021c480",
"email": "user@channex.io",
"name": "Channex User",
"system_role": "user"
}
}
}
}
}
}

Bad Request Error Response

Status Code: 400 OK

{
"errors": {
"code": "bad_request",
"title": "Bad Request"
}
}

Method require valid Confirmation Token passed as GET argument.

Fields

token [required] String value. token will be sent to email after registration with the Sign Up method.

Returns

Success Method can return Success result with 200 OK HTTP Code if operation is successfully finished. Will contain Session object at answer.

Bad Request Error Method can return Bad Request Error result with 400 Bad Request HTTP Code if token is invalid.