Access Application Settings
This walkthrough demonstrates how to access your application’s settings. The steps include retrieving your APS applications and its details, accessing collaborator details, and fetching the usage daily totals for a specific application.
Before you Begin
- Register and create an application on APS.
- Acquire a 3-legged OAuth token with
application:client:read
scope. - Invite a user to collaborate on an application you created in bullet one. This will be important for when retrieving the collaborators for an application.
Step 1: Retrieve an Access Token
In order to access the Application Management API operations, you need to obtain a valid three-legged access token. To do so, in Postman under the Authorization tab of each request, input a client ID and client secret of an APS application you own or have access to. For the same application, add https://oauth.pstmn.io/v1/callback as a callback URL in the APS application settings. If this is not added, you will receive an error message in your browser when you try to get a new access token.
Step 2: Get all Application details
The Get All Applications operation returns a list of clients or APS apps that you own or have access to as a collaborator. The response includes the client ID, name, description, and other pertinent details. For a formal definition of a client, refer to the API Basics documentation.
You will use the following operation:
HTTP Request | Operation |
---|---|
GET /clients | Get All Applications |
Request
curl -v 'https://developer.api.autodesk.com/applications/v1/clients' -H 'Authorization: Bearer <YOUR_ACCESS_TOKEN>'
Notes:
- Replace
<YOUR_ACCESS_TOKEN>
with the token obtained in Step 1.
Response
{
"pagination": {
"limit": 100,
"nextUrl": "https://developer.api.autodesk.com/~NEXT_PAGE~",
"previousUrl": "https://developer.api.autodesk.com/~PREVIOUS_PAGE~"
},
"results": [
{
"id": "pWPf8f2U2rWJfPgRnj3TnUCKHASOZJpp",
"createdAt": "2019-01-01T00:00:00.000Z",
"updatedAt": "2019-01-01T00:00:00.000Z",
"name": "Internet Widgits Pty Ltd",
"description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus vel facilisis ex. Nullam lobortis id lectus ac rutrum.\n",
"oAuthFlows": [
{
"clientType": "CONFIDENTIAL",
"grantType": "AUTHORIZATION_CODE",
"pkce": "OPTIONAL"
},
{
"clientType": "CONFIDENTIAL",
"grantType": "CLIENT_CREDENTIALS",
"pkce": "UNSUPPORTED"
},
{
"clientType": "PUBLIC",
"grantType": "IMPLICIT",
"pkce": "UNSUPPORTED"
}
],
"jwksUri": "https://example.com/.well-known/jwks.json",
"secretCreatedAt": "",
"preparedSecretExpiresAt": "2019-01-01T00:00:00.000Z",
"callbackUris": [
"https://example.com/oauth/callback"
],
"apiProductIds": [
"29ce79ba-8e63-411f-b549-44c7174eff93"
],
"owner": {
"userId": "389JJQ8PJSMJ",
"firstName": "Ada",
"lastName": "Lovelace",
"email": "ada.lovelace@example.com"
}
}
]
}
Step 3: Get a Specific Application’s Details
The Get an Application operation returns details of a single APS application. The response will be similar to the one in Step 2. You will use the following operation:
HTTP Request | Operation |
---|---|
GET /clients/{id} | Get an Application |
Request
curl -v 'https://developer.api.autodesk.com/applications/v1/clients/{CLIENT_ID}' -H 'Authorization: Bearer <YOUR_ACCESS_TOKEN>'
Notes:
- Replace
<YOUR_ACCESS_TOKEN>
with the token obtained in Step 1. - Replace
{CLIENT_ID}
with the client ID of the application you want to retrieve details for.
Response
{
"id": "pWPf8f2U2rWJfPgRnj3TnUCKHASOZJpp",
"createdAt": "2019-01-01T00:00:00.000Z",
"updatedAt": "2019-01-01T00:00:00.000Z",
"name": "Internet Widgits Pty Ltd",
"description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus vel facilisis ex. Nullam lobortis id lectus ac rutrum.\n",
"clientType": "WEB",
"jwksUri": "https://example.com/.well-known/jwks.json",
"secretCreatedAt": "",
"preparedSecretExpiresAt": "2019-01-01T00:00:00.000Z",
"callbackUris": [
"https://example.com/oauth/callback"
],
"apiProductIds": [
"29ce79ba-8e63-411f-b549-44c7174eff93"
],
"owner": {
"userId": "389JJQ8PJSMJ",
"firstName": "Ada",
"lastName": "Lovelace",
"email": "ada.lovelace@example.com"
}
}
Step 4: Get Collaborators for a Specific Application
Get All Collaborators operation provides the capability of retrieving a list of collaborators based on a client ID. For a formal definition of a collaborator, refer to the API Basics documentation.
You will use the following operation:
HTTP Request | Operation |
---|---|
GET /clients/{id}/collaborators | Get All Collaborators |
Request
curl -v 'https://developer.api.autodesk.com/applications/v1/clients/:id/collaborators' -H 'Authorization: Bearer <YOUR_ACCESS_TOKEN>'
Notes:
- Replace
<YOUR_ACCESS_TOKEN>
with the token obtained in Step 1.
Response
{
"pagination": {
"limit": 100,
"nextUrl": "https://developer.api.autodesk.com/~NEXT_PAGE~",
"previousUrl": "https://developer.api.autodesk.com/~PREVIOUS_PAGE~"
},
"results": [
{
"userId": "389JJQ8PJSMJ",
"firstName": "Ada",
"lastName": "Lovelace",
"email": "ada.lovelace@example.com",
"accessLevel": "VIEWER",
"createdAt": "2019-01-01T00:00:00.000Z"
}
]
}
Step 5: Get Usage Daily Totals for a Specific Application
Get Application’s Daily Total Usage operation supports retrieving daily token usage for an application of a given date range.
You will use the following operation:
HTTP Request | Operation |
---|---|
GET /clients/{id}/usage/daily-totals | Get Application’s Daily Total Usage |
Request
curl -v 'https://developer.api.autodesk.com/applications/v1/clients/:id/usage/daily-totals?filter[date]=<SPECIFIED_DATE_RANGE>' -H 'Authorization: Bearer <YOUR_ACCESS_TOKEN>'
Notes:
- Replace
<YOUR_ACCESS_TOKEN>
with the token obtained in Step 1. - Replace
<SPECIFIED_DATE_RANGE
with the date range you want to filter the usage for. The date range must be in the format ofYYYY-MM-DD..YYYY-MM-DD
.
Response
{
"results": [
{
"date": "2063-04-05",
"usage": [
{
"service": "REALITY_CAPTURE",
"tokens": 47
},
{
"service": "MODEL_DERIVATIVE",
"tokens": 35
}
]
}
]
}