Get Thumbnail URL
Key learnings
By the end of this task, you will be able to:
- Query a version of a component.
- Display URL of Thumbnail.
Prerequisite Tasks
As a prerequisite for completing the current task, you need to complete the following tasks:
Queries used in this task
You will use the following queries in this task:
Type | Operation | Description |
---|---|---|
Query | componentVersion | Retrieves an object representing a version of a component. |
Step 1 - Extract the URL of the Thumbnail
The componentVersion query returns a ComponentVersion object, which represents the tip version of the component. You extract the URL of the thumbnail by mining the Thumbnail object.
- In Manufacturing Data Model Explorer, enter the following query in the Query pane:
Query
query GetComponentVersion ($componentVersionId: String!) { componentVersion(componentVersionId: $componentVersionId) { thumbnail { status smallImageUrl } } }
Show More
- In the Query Variables Pane, copy the value of the
tipVersion
ID of the version of the component that you noted down in Generate Thumbnail, and specify it as the value for thecomponentVersionId
.
Query Variables
{
"componentVersionId": "Y29tcH5jby5uckdoR0ZIb1FXU3NQdFlhU0V2YThnfkxIZVdyeTViTlBscEI1NFZUUk1JQkhfYWdhfkRBNWdhRHpUYU5vYkg4S25ObnlZek4"
}
- Click Play. Thumbnail URL is generated. Note down the value of
smallImageUrl
returned by the query. You should see a similar request response as in the following code-block:
Response
{
"data": {
"componentVersion": {
"thumbnail": {
"status": "SUCCESS",
"smallImageUrl": "https://developer.api.autodesk.com/derivativeservice/v2/thumbnails/dXJuOmFkc2sud2lwcHJvZDpmcy5maWxlOnZmLll6NGI4QmpxU3J5ZjVhUHd1NndUSkE_dmVyc2lvbj0x?type=small&guid=94fd7d43-12f5-43d4-a313-8fe080196f0c"
}
}
}
}
Note: The status mentioned in the response is the result of successful execution of the requests. If the requests are not successful, we recommend that you retry executing the queries to get a successful response. For more information about other possible statuses, see ThumbnailStatusEnum.
After working through the steps mentioned above, you should see a screen similar to the following image.