Task 2 – Get Versions of a Design
By the end of this task, you will be able to:
- Fetch versions for a particular design.
- Make sense of the options and fields in the documentation on the aecDesignAtTip query, Design object, and lineage / versions object.
You will use the following queries in this task:
Type | Operation | Description |
---|---|---|
Query | aecDesignAtTip | Retrieves design at tip. |
Step 1: Request for a particular Design
The aecDesignAtTip query returns a Design object. The Design object contains an array of elements objects. For this exercise, we request the name
field and the entire lineage object of the design.
- In the AEC Data Model Explorer, the query is populated by default in the Query Pane. You can also edit or update the query as per your requirement and run it.
Query
query ($designId: ID!) { aecDesignAtTip(designId: $designId) { id name alternativeRepresentations { fileUrn fileVersionUrn } lineage { versions { results { versionNumber createdOn } } } } }
Show More
- In the Query variables pane, set the variable as the design ID value obtained in the previous task.
Query Variables
{ "designId" : "YWVjZH5xcTdtR2JYNVV4NDNNVmJES3cwZGVuX0wyQ35iaEtKQV8zdFIxbW5LVTVVVTRjTkV3" }
- Click Play. All the previously published versions of that design will be displayed in the response. The response should be similar to the following code-block:
Response
{ "data": { "aecDesignAtTip": { "id": "YWVjZH5xcTdtR2JYNVV4NDNNVmJES3cwZGVuX0wyQ35iaEtKQV8zdFIxbW5LVTVVVTRjTkV3", "name": "Snowdon Towers Sample Architectural.rvt", "alternativeRepresentations": { "fileUrn": "urn:adsk.wipprod:dm.lineage:bhKJA_3tR1mnKU5UU4cNEw", "fileVersionUrn": "urn:adsk.wipprod:fs.file:vf.bhKJA_3tR1mnKU5UU4cNEw?version=5" }, "lineage": { "versions": { "results": [ { "versionNumber": 5, "createdOn": "2023-05-12T18:06:30.313Z" }, { "versionNumber": 4, "createdOn": "2023-05-12T15:38:43.464Z" }, { "versionNumber": 3, "createdOn": "2023-05-05T15:23:06.798Z" }, { "versionNumber": 2, "createdOn": "2023-05-05T04:26:47.396Z" } ] } } } } }
Show More
After working through the steps mentioned above, you should see a screen similar to the following image: