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
- To retrieve the token, log on to Quantium systems with your user credentials
- On the top-right corner of the application, click on the user icon and select Administrator dashboard
![AdminDashboardAccess-1.png 381](https://files.readme.io/b15c876-AdminDashboardAccess-1.png)
- In the Administrator dashboard, look at the left bar and click on API token
![AdminDashboardAccess-2.jpg 261](https://files.readme.io/3ca1f2b-AdminDashboardAccess-2.jpg)
- Click on the Retrieve developer API Token button
![AdminDashboardAccess-3.png 997](https://files.readme.io/8416d27-AdminDashboardAccess-3.png)
- After the bearer token is generated click on the
Copy to clipboard
button to copy this token to your code
![AdminDashboardAccess-4.png 915](https://files.readme.io/e1ef944-AdminDashboardAccess-4.png)
- 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
- 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 Method | POST |
Path | /api/auth/password/token |
Request parameter | JSON 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':'********'}"
- 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.
....
}
Updated about 2 years ago
What’s Next