Registration and Authentication

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

Sign Up

Register a new user in the system.

Request:

POST https://staging.bookdirect.com/api/v1/sign_up

Query body (JSON):

{
  "user" : {
    "email": "[email protected]",
    "name": "BookDirect User",
    "password": "password",
    "password_confirmation": "password"
  }
}

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:

Query body (JSON):

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:

Query body (JSON):

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:

Query body (JSON):

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:

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.

Last updated

Was this helpful?