Authentication Endpoint

Requests

Bryj API accepts and returns JSON messages over HTTPS. Unless otherwise stated, the common end-point is: https://core.bryj.ai/api

All requests should include the headerAccept: application/json“.
The body of the requests is a JSON document, containing the required additional parameters to perform the request. If the request has a body, please also include the headerContent-type: application/json“.
Most of the services require authorization. Authorization is granted via an access token that you can retrieve with the authentication API. All subsequent requests must contain the header Authorization: YOUR_AUTHORIZATION_TOKEN.

Responses

Success

Successful requests will have an HTTP status code 200. The result will have the following format:

{
  Response attibutes
}

Errors

On the other hand, in case of error, the status code will not be 200.

If there is a logical or other problem with the initial request, the status code will be in the range of 400499, and a message explaining the problem will be returned. If such an error occurs, you will have to correct the error before attempting to call the server again.

{
  "error_message": "There has been an error"
}

On rare occasions, you may encounter unexpected errors, with the status code in the range of 500599. These errors can occur for various reasons, such as network connectivity, server unavailability etc. Due to the nature of these errors, a formatted message cannot be always returned. In most cases, you will be able to repeat the request after a while. If these errors are recurring, please contact your CSM.

Authentication

This endpoint will not consume your API requests quota in your subscription.

This endpoint allows you to authenticate and gets an AUTHORIZATION_TOKEN to use for other requests :

Endpoint: POST https://core.bryj.ai/users/sign_in.json

Parameters using JSON body:

PropertyTypeDescriptionDefault
user[email]StringThe user’s e-mailrequired
user[password]StringThe user’s e-mailrequired

Example:

{
   "user":{
      "email":"user@bryj.ai",
      "password":"userpassword"
   }
}

Response:

For successful requests, you get an authorization bearer token in the header of the request, and a JSON message containing some user’s attributes :

Response Headers
Date: Wed, 18 May 2022 14:45:18 GMT
.
.
Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJiOTc2OTJjZi0xZmYxLTRkYzEtOWM5Ni01ZDI3MGM3MGZiYTkiLCJzY3AiOiJ1c2VyIiwiYXVkIjpudWxsLCJpYXQiOjE2NTI4NjcxMTgsImV4cCI6MTY1Mjg3MDcxOCwianRpIjoiYzllM2ZhY2ItNTkyYS00OTg0LTlkNmUtNjQ4YTg1ODljOWRkIn0.G1-_rGmWnjM7zqJcMQqzPWQH-enqRvLCKaiCe9XYM4k
.
.
PropertyTypeDescription
userObjectAn object containing more information around the authenticated user.
The Authorization header must be added to all bryj API calls with the obtained value Bearer XXXXXXXX.
  • Status OK: 200
{
   "user":{
      "email":"user@bryj.ai",
      "password":"userpassword"
   }
}
  • Status KO : HTTP_RESPONSE_ERROR_CODE (ERROR)
{
  "error_message": “ERROR_MESSAGE”
}

Appendix

Authentication example cURL

curl --request POST 'https://core.bryj.ai/users/sign_in.json' \
--header 'Content-Type: application/json' \
--data-raw '{
   "user":{
      "email":"YOUR_EMAIL",
      "password":"YOUR_PASSWORD"
   }
}'

Authentication example using POSTMAN

Headers:

Body:

Response :