To use your APIs using curl command:
Create an Application Access in Usage Engine as described in Configuring Application Access. Ensure to copy the Client Secret during creation since it will only be visible at that time.
Call the authorization api with your Application credentials. Configure the audience based on which Environments you are calling.
client_id="f9bP7jTE63gNlA8jluCoPMs2ueP7si1L" client_secret="woN7vnKUVAC-y_WVd8Eih6R06mNfFA9V9ZUjid5Ae7iGE5R8Kll_fFY7EiRQ0d-9" curl "https://api.digitalroute.io/authentication/v1/oauth/token" \ -X POST \ -H "Content-Type: application/x-www-form-urlencoded" \ -d client_id=${client_id} \ -d client_secret=${client_secret} \ -d grant_type="client_credentials" \ -d audience="https://api.digitalroute.io/"
Example Response
{ "access_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6ImZUYU5saGpnclFERE0xYkdVZG1WeiJ9.eyJhY2NvdW50SWQiOiJhZDZmZWM5NS1lMDYzLTQ5MmItOTJjYy01MmJiNjJjMGU3NTAiLCJpc3MiOiJodHRwczovL2F1dGguZGlnaXRhbHJvdXRlLmlvLyIsInN1YiI6IjhtMUhUMHA2SkdMOVJjbzhWNEZjWGZ2Y2dHejcwcms4QGNsaWVudHMiLCJhdWQiOiJodHRwczovL2FwaS5kaWdpdGFscm91dGUuaW8vIiwiaWF0IjoxNzE2NDY5Njg5LCJleHAiOjE3MTY0NzMyODksInNjb3BlIjoiY3JlYXRlOm1ldGVyX3R5cGVzIGNyZWF0ZTptZXRlcnMgZGVsZXRlOm1ldGVyX3R5cGVzIGRlbGV0ZTptZXRlcnMgcmVhZDptZXRlcl90eXBlcyByZWFkOm1ldGVycyB1cGRhdGU6bWV0ZXJfdHlwZXMiLCJndHkiOiJjbGllbnQtY3JlZGVudGlhbHMiLCJhenAiOiI4bTFIVDBwNkpHTDlSY284VjRGY1hmdmNnR3o3MHJrOCJ9.WIK81gLKz0WKUDctehRdttTl0A5NvNmzop0DwEBPCfy3j9iCKESCpjHRfETqUqHRmKUIMiIgmramE-5qPLorKWheazK6AF5GHLCJ4on6u67-kUNm-EVM23USa0f0r0aA4u17xW9SXtJhJZg4XWjmnH_1YBxf5w4llwE1J61ldB3SxA7RtizN7c160wjBdr4iAHE8_0yxzbF4X1AgEHmtZEyBQdJE6JPl3Tp4cnE3kO4VPed5VCwlIKDedkN93k25UBWSrN1Oh88SBhkcueqnT_yIvd4vXwkXXJHMwf0ti6YrVeYh9yaSmeNBqSG2UbFP1_V-8GoX8U0GnlprYw6INw", "expires_in": 3600, "scope": "create:meter_types create:meters delete:meter_types delete:meters read:meter_types read:meters update:meter_types update:meters", "token_type": "Bearer" }
Make a request to a protected resource with the access key in the authorization header.
Example of Calling the usage-metering API
curl 'https://api.digitalroute.io/usage-metering/v1/meters?limit=100&skip=0' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6ImZUYU5saGpnclFERE0xYkdVZG1WeiJ9.eyJhY2NvdW50SWQiOiJhZDZmZWM5NS1lMDYzLTQ5MmItOTJjYy01MmJiNjJjMGU3NTAiLCJpc3MiOiJodHRwczovL2F1dGguZGlnaXRhbHJvdXRlLmlvLyIsInN1YiI6IjhtMUhUMHA2SkdMOVJjbzhWNEZjWGZ2Y2dHejcwcms4QGNsaWVudHMiLCJhdWQiOiJodHRwczovL2FwaS5kaWdpdGFscm91dGUuaW8vIiwiaWF0IjoxNzE2NDY5Njg5LCJleHAiOjE3MTY0NzMyODksInNjb3BlIjoiY3JlYXRlOm1ldGVyX3R5cGVzIGNyZWF0ZTptZXRlcnMgZGVsZXRlOm1ldGVyX3R5cGVzIGRlbGV0ZTptZXRlcnMgcmVhZDptZXRlcl90eXBlcyByZWFkOm1ldGVycyB1cGRhdGU6bWV0ZXJfdHlwZXMiLCJndHkiOiJjbGllbnQtY3JlZGVudGlhbHMiLCJhenAiOiI4bTFIVDBwNkpHTDlSY284VjRGY1hmdmNnR3o3MHJrOCJ9.WIK81gLKz0WKUDctehRdttTl0A5NvNmzop0DwEBPCfy3j9iCKESCpjHRfETqUqHRmKUIMiIgmramE-5qPLorKWheazK6AF5GHLCJ4on6u67-kUNm-EVM23USa0f0r0aA4u17xW9SXtJhJZg4XWjmnH_1YBxf5w4llwE1J61ldB3SxA7RtizN7c160wjBdr4iAHE8_0yxzbF4X1AgEHmtZEyBQdJE6JPl3Tp4cnE3kO4VPed5VCwlIKDedkN93k25UBWSrN1Oh88SBhkcueqnT_yIvd4vXwkXXJHMwf0ti6YrVeYh9yaSmeNBqSG2UbFP1_V-8GoX8U0GnlprYw6INw'
Example Response
{ "meterTypes": [ { "accountId": "4d6548c8-1793-498f-9306-9ec101cb9bf8", "activeFrom": "2023-07-26T09:00:15.690+00:00", "activeTo": "2024-11-22T00:00:00.000+00:00", "aggregation": { "type": "increment" }, "category": "API Counts", "createdAt": "2023-07-26T09:00:15.690+00:00", "description": "Meter definition to count the number of API requests per customer", "externalRef": "878752b4-4ddf", "id": "645ed240-02b5-400c-9a3c-21857e8f2ac4", "name": "Usage based API counter", "numberOfMeters": 0, "resetSchedule": { "day": "L", "hour": "0", "minute": "0", "month": "*", "weekday": "*" }, "timezone": "Etc/UTC", "unit": "requests", "updatedAt": "2023-07-26T09:00:15.690+00:00" } ] }
Note: These example uses Production EU URL for accessing the APIs, update the URL based on your Environments .