View and download sample Python code for an authorization script.
To receive Server-Sent Events (SSE) from Aria, the Data Stream Client must pass an Authentication Token that is obtained via Aria's Data Stream Authentication Service. This Authentication Service is accessible via an HTTPS endpoint.
Note: Once the Data Stream Client successfully connects to Aria and begins parsing SSEs, it is expected to run continually. If the stream is interrupted, you must obtain a new Authentication Token to reconnect the Data Stream Client.
POST /oauth2/token HTTP/1.1
Content-Type: application/x-www-form-urlencoded
grant_type=client_credentials&client_id=<clientno>&client_secret=<secret>
Alternatively, the service accepts a JSON request of the form:
POST /oauth2/token HTTP/1.1
Content-Type: application/json
{
"grant_type" : "client_credentials",
"client_id" : <clientno>,
"client_secret" : <secret>
}
In the above:
Authentication will fail if:
For Example:
POST /oauth2/token HTTP/1.1
Content-Type: application/x-www-form-urlencoded
grant_type=client_credentials&client_id=3286184&client_secret=jsrhnCEg78Mk3stYDxDhTvNmy3fjq7EE
Or, the equivalent in JSON:
POST /oauth2/token HTTP/1.1
Content-Type: application/JSON
{
"grant_type" : "client_credentials",
"client_id" : "<clientno>",
"client_secret" : "<secret>"
}
HTTP/1.1 200 OK
Cache-Control: no-store, no-cache, must-revalidate
Pragma: no-cache
Content_Type: application/json
{
"access_token" : "<token>",
"token_type" : "<token_type>",
"expires_in" : <exp>
}
Where:
Authorization: <token_type> <token>
If a Data Streaming API returns a 401 status code, the current token is invalid and a new one must be retrieved by performing steps 1. and 2. as outlined above. A token is invalid under one of the following conditions:
400 Bad Request
Rejected requests will be responded to with a 400 status code. The response will have a content-type of application/json and the response body will be of the form:
{
"error" : <error>,
"error_description" : <error_description>,
"error_uri" : <error_uri>
}
Where:
415 Unsupported Media Type
A status code of 415 is returned if the Content_Type of the request is neither application/x-www-form-urlencoded or application/json.
View and download sample Python code for an authorization script.
The Data Streaming Authorization service validates the caller's source IP (and optional client certificate) against your Aria tenant. The token generated by this service will be validated against the same IP ranges and client certificate when it is passed to Aria via your Data Stream Client.
Subtopics
Data Streaming Overview
Data Stream Client & Server-Sent Events (SSE)
Consuming Aria Data Streams
Subscribing to Objects in the Data Streams
Data Streaming Authentication
Data Streaming Logical Object Model
Data Streaming JSON Representation
Example Data Streaming Code
Data Streaming Frequently Asked Questions