Test
...
Your APIs
...
Using curl
Create an Application Access in Usage Engine by following the instruction as described in Configuring Application Access. Ensure to copy the Client Secret during creation since it will only be visible when creating the Application Accessat that time.
Call the authorization api with your Application credentials.
Code Block | ||
---|---|---|
| ||
curl --location -X POST -H "Content-Type: application/x-www-form-urlencoded" "<https://api.digitalroute.io/authentication/v1/oauth/token>" --data client_secret="woN7vnKUVAC-y_WVd8Eih6R06mNfFA9V9ZUjid5Ae7iGE5R8Kll_fFY7EiRQ0d-9" --data client_id="f9bP7jTE63gNlA8jluCoPMs2ueP7si1L" |
Example Response:
Code Block | ||
---|---|---|
| ||
{"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","token_type":"Bearer"} |
Make a request to a protected resource with the access key in the Authorization header.
Example of calling Calling the usage-metering api:API
Code Block | ||
---|---|---|
| ||
curl --location '<https://api.digitalroute.io/usage-metering/v1/meters?limit=100&skip=0>' \ --header 'Accept: application/json' \ --header 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6ImZUYU5saGpnclFERE0xYkdVZG1WeiJ9.eyJhY2NvdW50SWQiOiJhZDZmZWM5NS1lMDYzLTQ5MmItOTJjYy01MmJiNjJjMGU3NTAiLCJpc3MiOiJodHRwczovL2F1dGguZGlnaXRhbHJvdXRlLmlvLyIsInN1YiI6IjhtMUhUMHA2SkdMOVJjbzhWNEZjWGZ2Y2dHejcwcms4QGNsaWVudHMiLCJhdWQiOiJodHRwczovL2FwaS5kaWdpdGFscm91dGUuaW8vIiwiaWF0IjoxNzE2NDY5Njg5LCJleHAiOjE3MTY0NzMyODksInNjb3BlIjoiY3JlYXRlOm1ldGVyX3R5cGVzIGNyZWF0ZTptZXRlcnMgZGVsZXRlOm1ldGVyX3R5cGVzIGRlbGV0ZTptZXRlcnMgcmVhZDptZXRlcl90eXBlcyByZWFkOm1ldGVycyB1cGRhdGU6bWV0ZXJfdHlwZXMiLCJndHkiOiJjbGllbnQtY3JlZGVudGlhbHMiLCJhenAiOiI4bTFIVDBwNkpHTDlSY284VjRGY1hmdmNnR3o3MHJrOCJ9.WIK81gLKz0WKUDctehRdttTl0A5NvNmzop0DwEBPCfy3j9iCKESCpjHRfETqUqHRmKUIMiIgmramE-5qPLorKWheazK6AF5GHLCJ4on6u67-kUNm-EVM23USa0f0r0aA4u17xW9SXtJhJZg4XWjmnH_1YBxf5w4llwE1J61ldB3SxA7RtizN7c160wjBdr4iAHE8_0yxzbF4X1AgEHmtZEyBQdJE6JPl3Tp4cnE3kO4VPed5VCwlIKDedkN93k25UBWSrN1Oh88SBhkcueqnT_yIvd4vXwkXXJHMwf0ti6YrVeYh9yaSmeNBqSG2UbFP1_V-8GoX8U0GnlprYw6INw' |
Example Response:
Code Block |
---|
{ "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": "string", "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" } ] } |