Export Usage Information
Before You Begin
Make sure that you have registered an app. and successfully acquired an OAuth token with the data:write
scope.
Step 1: Obtaining an Access Token
All calls to the Export Data API must be authenticated and a valid access token is required for each API call. Please refer to this walkthrough on how an access token can be obtained.
Step 2: Submit an Export request
The Export Data API exposes a POST /exports endpoint that allows for the submission of export requests. Exports are processed asynchronously. This endpoint returns an export Id, which is then used with the GET /exports/:exportId endpoint to check the export status and retrieve the results.
Example Request
Here is an example request to export SUBSCRIPTIONS data in Excel format, for all teams managed by the logged in user.
curl -X POST \
'https://developer.api.autodesk.com/insights/v1/exports' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer eyJhbGciOiJIUzI1N' \
-d '{
"outputFormat": "EXCEL",
"reports": ["SUBSCRIPTIONS"]
}'
Note that line breaks have been added to the cURL command above for ease of reading. Make sure to remove them before executing any code in your terminal.
If successful, the response body looks like:
{
"id": "064324c4-2fe6-4fe3-91e8-8aacb22b1376",
"timestamp": "2021-11-03T22:10:56Z",
"downloads": [],
"status": "SUBMITTED",
"outputFormat": "EXCEL",
"teamId": null,
"teamName": null,
"reports": [
"SUBSCRIPTIONS"
]
}
The response contains a id
field, which is vital information to be used for the next step.
Response shows the request SUBMITTED
to get subscription data in EXCEL
format for all teams managed by the logged in user.
Step 3: Get specific Export Results
Using the id
value returned in Step 2, poll the GET /exports/:exportId
endpoint to check the status of the export. A status of ERROR indicates that the query failed due to an error; SUBMITTED indicates that the export is queued, and the result is not yet available.
Example Request
Here is an example to get Export Result for a specific Id (exportId).
curl -X GET \
'https://developer.api.autodesk.com/insights/v1/exports/064324c4-2fe6-4fe3-91e8-8aacb22b1376' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer eyJhbGciOiJIUzI1N'
Note that line breaks have been added to the cURL command above for ease of reading. Make sure to remove them before executing any code in your terminal.
If successful, the response body looks like:
{
"id": "064324c4-2fe6-4fe3-91e8-8aacb22b1376",
"timestamp": "2021-11-03T22:10:56Z",
"downloads": [{
"type": "SUBSCRIPTIONS",
"downloadURL": "https://presigned-url..."
}],
"status": "COMPLETED",
"outputFormat": "EXCEL",
"teamId": null,
"teamName": null,
"reports": [
"SUBSCRIPTIONS"
]
}
Response shows export request for SUBSCRIPTIONS
data successfully COMPLETED
and the EXCEL
output is available in the specified downloadURL
.
The downloadURL
attribute is a pre-signed URL that gives direct access to the exported file. Note that anyone with this link is able to access the file.
For security reasons, this link expires in the (relatively short) period of time, call GET /exports/:exportId again to get a new downloadURL
.
Step 4: View all Export Requests
Optionally you can also look at all the exports requested so far using endpoint GET /exports
Example Request
Get all the exports requested in last two weeks. Older exports are deleted.
curl -X GET \
'https://developer.api.autodesk.com/insights/v1/exports' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer eyJhbGciOiJIUzI1N'
Note that line breaks have been added to the cURL command above for ease of reading. Make sure to remove them before executing any code in your terminal.
If successful, the response body looks like:
{
"exports": [{
"id": "064324c4-2fe6-4fe3-91e8-8aacb22b1376",
"timestamp": "2021-11-03T22:10:56Z",
"downloads": [{
"type": "SUBSCRIPTIONS",
"downloadURL": "https://presigned-url..."
}],
"status": "COMPLETED",
"outputFormat": "EXCEL",
"teamId": null,
"teamName": null,
"reports": [
"SUBSCRIPTIONS"
]
},
{
"id": "b086e1d4-f044-4c39-8ce6-3e31b48322a0",
"timestamp": "2021-10-25T22:31:13Z",
"downloads": [{
"type": "USERS",
"downloadURL": "https://presigned-url..."
}],
"status": "COMPLETED",
"outputFormat": "EXCEL",
"teamId": "4280140",
"teamName": "Welch Grape Shack",
"reports": [
"USERS"
]
}
],
"pagination": {
"offset": 0,
"limit": 100,
"totalResults": 2
}
}
Response shows 2 Export requests are available at specified downloadURL
.
First export with id
‘064324c4-2fe6-4fe3-91e8-8aacb22b1376’ is limited to SUBSCRIPTIONS
data for all teams.
Second export with id
‘b086e1d4-f044-4c39-8ce6-3e31b48322a0’ is limited to USERS
data for specific team.