GraphQL Endpoint
POST dataexchange/2023-05/graphql
Sends GraphQL requests to the 2023-05
version of the Data Exchange GraphQL API service and returns responses in the JSON format.
Resource Information
Method and URI | |
Authentication Context | user context required |
Required OAuth Scopes | data:read |
Data Format | JSON |
Request
Headers
Authorization* string | Must be Bearer <TOKEN> , where <TOKEN> is an access token obtained by a three-legged OAuth flow. |
Content-Type string | Must be application/json . |
Region string | Must be US or EMEA . |
Note: The Data Exchange GraphQL service is accessible in the United States (US) and the Europe, Middle East, and Africa (EMEA) region. If you want to access data from a specific region, include a region header in your request, such as Region: US or Region: EMEA. If you don’t provide a region header, your request will automatically be routed to the default region, which is the United States.
Request
Body Structure
Request body to send a GraphQL query.
query* object | Contains the GraphQL query to send to the Data Exchange GraphQL API service. |
variables object | Contains a set of key-value pairs, where the keys correspond to the names of the variables defined in your GraphQL query, and the values represent the values of those variables. |
Example 1
This example demonstrates how to use cURL to send a GraphQL query to the Data Exchange GraphQL API service.
Request
curl --location 'https://developer.api.autodesk.com/dataexchange/2023-05/graphql' \
--header 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsImtNwzPPdpCo740uFQ....' \
--header 'Region: US' \
--header 'Content-Type: application/json' \
--data '{"query":"query Exchange($exchangeId: ID!){ exchange(exchangeId: $exchangeId) { elements { results { id name properties { results { name value } } } } }}","variables":{"exchangeId":"18f22e98-241c-332b-a610-8c66f87bcd97"}}'
Response
{
"data": {
"exchange": {
"elements": {
"results": [
{
"id": "83EFE862322051AA757717FF4F72702AE82B68A8",
"name": "359330",
"properties": {
"results": [
{
"name": "category",
"value": "Windows"
},
{
"name": "family",
"value": "Fixed"
},
{
"name": "type",
"value": "36\" x 48\""
},
{
"name": "name",
"value": "359330"
},
{
"name": "sourceId",
"value": "b39727d0-fac7-4e2b-b6ca-bdc2e3caf878-00057ba2"
},
{
"name": "Volume",
"value": 0.042134214118499255
},
{
"name": "Area",
"value": 2.289672839999995
},
{
"name": "Export to IFC",
"value": 0
},
{
"name": "IfcGUID",
"value": "2pboVG_iTEAxRAlSBZpuFQ"
},
{
"name": "Phase Created",
"value": "New Construction"
},
{
"name": "Operation",
"value": "INSERT"
}
]
}
}
]
}
}
}
}
Example 2
This example demonstrates how to use Axios in JavaScript to send a GraphQL query to the Data Exchange GraphQL API service.
Request
axios({
method: 'POST',
url: 'https://developer.api.autodesk.com/dataexchange/2023-05/graphql',
headers: {
'Authorization': 'Bearer YOUR_ACCESS_TOKEN_HERE',
'Region: US'
},
data: {
query: `{
hubs {
results {
name
}
}
}`
}
})
Note: Axios automatically sets the Content-Type
header to application/json
.
Response
{
"data":{
"hubs":{
"results":[
{
"id":"b.438ed63f-39c9-4ec4-80ca-1f9a193et0d4",
"name":"Golden Gate"
},
{
"id":"b.7c52c85a-8e52-4893-9038-6d77ac9dc742",
"name":"DataExchange"
}
]
}
}
}