Pull Usage Data Using API Keys
1. Generate the API Key
- Click on Account > Access & Roles in the left pane and click on the API Key icon at the top.
- Click the Add button to generate a new key.
- Take note of the Access Key and Secret Key. Once you close the window, the Secret Key can never be retrieve so keep the key safe
2. Generate the JWT
- Using a API Development Environment (i.e. Postman), POST the Access key and the Secret key to https://api.hyalto.com/accountManagement/auth/token
- The result is the JWT. It should look similar to this:
{
"tokenType": "Bearer",
"accessToken": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJqdGkiOiJkYmY4MzU3Ni04NGJkLTQwMTAtYWUxYi00NWQ0Yjcx
NWYyMmIiLCJpYXQiOjE1Mjg3Mjk4NTksImV4cCI6MTUyODczMzQ1OSwiaXNzIjoiYXBpLmh5YWx0by1zdGFnaW5nLmNvbSIsInNj
b3BlIjoiYWxsIiwic2VydmljZVByb3ZpZGVySWQiOjE2NCwiYWNjb3VudElkIjoxNjQsImNvbXBhbnlOYW1lIjoiRGVtbyBDby4iLCJ1c2Vy
SWQiOm51bGwsInVzZXJuYW1lIjpudWxsLCJhcGlLZXlJZCI6MTkwLCJhcGV4IjpmYWxzZSwiYWNjZXNzIjp7IkFjY291bnQgTWFuY
WdlbWVudCI6eyJDIjp0cnVlLCJSIjp0cnVlLCJVIjp0cnVlLCJEIjp0cnVlfSwiU29sdXRpb24gTWFuYWdlbWVudCI6eyJDIjp0cnVlLCJSI
jp0cnVlLCJVIjp0cnVlLCJEIjp0cnVlfSwiU2VydmljZSBNYW5hZ2VtZW50Ijp7IkMiOnRydWUsIlIiOnRydWUsIlUiOnRydWUsIkQiOnRy
dWV9LCJJVCBNYW5hZ2VtZW50Ijp7IkMiOnRydWUsIlIiOnRydWUsIlUiOnRydWUsIkQiOnRydWV9LCJQdXJjaGFzaW5nIjp7IkMiO
nRydWUsIlIiOnRydWUsIlUiOnRydWUsIkQiOnRydWV9LCJBU0EgTWFuYWdlbWVudCI6eyJDIjp0cnVlLCJSIjp0cnVlLCJVIjp0cnVlL
CJEIj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kQiOnRydWV9fX0.wh9IQaziPNUBcirNNdrg3a8as8SD_bGGdxzLDL_wxdY",
"scope": "all",
"expiresIn": 3600
}
Example in Postman:
You will need the JWT to do any further requests.
3. Retrieve List of Customers
Use a GET request from https://api.hyalto.com/accountManagement/accounts using the JWT "accessToken" you generated from the previous step as a Authorization Header
4. Retrieve List of Purchased Services
Using the customer "id" value from the above result, use a GET request to https://api.hyalto.com/serviceOfferings/accounts/{id}/services/ and the JWT "accessToken" as the Authorization Header
5. Retrieve Usage Data
Use a GET to https://api.hyalto.com/reports/usage/service/{service_id}?filter[from]={datetime}&filter[to]={datetime}
Where:
- service_id = Purchase Service "id" from Step 4
- datetime = Range of time used for the usage data (use format yyyy-mm-dd hh:mm:ss) (EX - 2018-07-13 12:00:00)