GuidesRecipesAPI Reference
Log In
Guides

Authentication

All API endpoints require an access token embedded in the request header. This token authentication is also known as Bearer Authentication

Retrieving API Token from Quantium Application

A bearer token can be acquired directly from Quantium systems for client administrator accounts

  1. To retrieve the token, log on to Quantium systems with your user credentials
  2. On the top-right corner of the application, click on the user icon and select Administrator dashboard
381
  1. In the Administrator dashboard, look at the left bar and click on API token
261
  1. Click on the Retrieve developer API Token button
997
  1. After the bearer token is generated click on the Copy to clipboard button to copy this token to your code
915
  1. The token generated from this page is valid for 1 hour.

Retrieving API Token from Quantium authentication API (optional)

A bearer token can be acquired directly from Quantium authentication API with your email and password

  1. To retrieve the token, Create POST request with email and password JSON body and send request to the authentication API.
{
  "email": "info@company.com",
  "password": "********"
}
Description
HTTP MethodPOST
Path/api/auth/password/token
Request parameterJSON body

Example

curl -X POST https://accounts-quantium.azurewebsites.net/api/auth/password/token
	 -H "Content-Type: application/json" 
     -d "{'email':'info@company.com','password':'********'}"
  1. After the request sent, The result will return with your token. And token is valid for 1 hour.
{
    "subject": "info@company.com",
    "token": "Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6IjZGNEU1ODhBQTQ2ODc1RDI5M0E2QkExOTg4RTc0OTVGIiwidHlwIjoiYXQrand0In0.eyJuYmYiOjE2MjIzODY2NDAsImV4cCI6MTYyMjM5MDI0MCwiaXNzIjoiaHR0cHM6Ly9hY2NvdW50cy1xdWF",
    "expired_UTC": "2021-05-30T15:57:20.273133Z"
}

Putting API Token in your HTTP Request code

Here is some code example to embed the bearer token into API request.

$.ajax({
   url: 'https://<Quantium CORE Web API URL>/<Path to resource>',
   type: 'GET',
   contentType: 'application/json'
   headers: {
      'Authorization': '<Bearer token copied from previous section>'
   },
   success: function (result) {
       // CallBack(result);
   },
   error: function (error) {

   }
});
var accessToken = "<Bearer token retrieved from previous section>";
using (var client = new HttpClient())
{
    var url = "https://<Quantium CORE Web API URL>/<Path to resource>";
    client.DefaultRequestHeaders.Add("Authorization", accessToken);
    var response = await client.GetStringAsync(url);
    // Parse JSON response.
    ....
}