Authorization Tutorial
Overview
In order to use any of the solutions provided in the API, you must have an Authorization Token. You can request an Authorization Token from the Authorization URI.
Authorization URI
The Authorization URI accepts user credentials and returns a uniquely generated Authorization Token for the specified user. You will need this Authorization Token for all of the other solutions provided in the API. The Authorization Token will expire after 8 hours.
Required Information
The Authorization URI requires you to have a user in the system. If you have not registered yet, contact support at: support@thedatagroup.com
The Authorization URI, like all of the solution URIs, also requires you to have an API Key. If you do not know your API Key, contact support to retrieve it. The API Key should be provided in the request header with the header attribute: x-api-key
The Authorization URI must be used with a POST request, where the request payload contains your username and password.
Example Request URL
The URL for the Authorization URI is: https://api.thedatagroup.com/{version}/auth, where {version} is the API Version you wish to use.
Request Headers
Header Attribute Header Value x-api-key {your api key} Content-Type application/json
Header Attribute | Header Value |
---|---|
x-api-key | {your api key} |
Content-Type | application/json |
Request Payload
The request payload for the Authorization URI must contain the username and the password attributes.
{ "username": "tutorialUser", "password": "tutorialPass" }
cURL Example
To query the Authorization URI, you can use one of the provided SDKs, a REST Client, or a simple cURL command. Below is an example of the cURL command for the example input information.
curl -X POST -H "Content-Type: application/json" -H "x-api-key: {your_key}" -H "Cache-Control: no-cache" -d '{ "username": "tutorialUser", "password": "tutorialPass" }' "https://api.thedatagroup.com/v3/auth"
Response Payload
The response payload for the Authorization URI will contain the generated Authorization Token, the expiration date for the Authorization Token, and the Id of the Account who owns the Authorization Token.
{ "authToken": "cef4df78ef54f74", "expires_in": 1461726337744, "account_id": "ef7d4ef" }