Task 1 – Get Designs Based on Metadata
This task allows you to query hubs based on metadata using RSQL and receive responses from the AEC Data Model server.
By the end of this task, you will be able to:
- Fetch designs from a hub based on the metadata using AEC Data Model Explorer.
- Use filters on metadata like createdOn or createdBy on designs with greater than or less than operators.
- Make sense of the options and fields in the documentation on the aecDesignsByHub query and AECDesign object.
You will use the following queries in this task:
Type | Operation | Description |
---|---|---|
Query | aecDesignsByHub | Retrieves designs in the given hub, using additional RSQL filters if provided. |
Step 1: Request a list of Hubs
The aecDesignsByHub query returns an AECDesigns object. While the AECDesigns object has many fields, for this exercise, we will be requesting the id
and the name
fields only.
- In 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 aecDesignsByHub($hubId: ID!, $filter: AECDesignFilterInput, $pagination: PaginationInput) { aecDesignsByHub(hubId: $hubId, filter: $filter, pagination: $pagination) { pagination { cursor } results { id name alternativeRepresentations { fileUrn fileVersionUrn } } } }
Show More
- In the Query Variables Pane, replace the value of the
hubId
variable with the hub ID of the project obtained previously in Get Started with AEC Data Model API’ tutorial’s Task 1.- In the Query variables pane, set the metadata filter according to your preferences. This will allow you to query the data that you need.
- In the Query variables pane, set the pagination limit to any required value. For clarity, we are setting the limit value to 5.
Note: For information on the supported metadata filtering options, refer Advanced Filtering Capabilities page.
Query Variables
{ "hubId": "b.03f98b13-ec95-461b-b945-765f496165c1", "filter": { "query": "metadata.createdOn>2023-05-01T06:37:13.472Z" }, "pagination": { "limit": 5 } }
Show More
- Click Play. A list of hubs that you have access to is displayed in the response section. It should be similar to the following code-block:
Response
{ "data": { "aecDesignsByHub": { "pagination": { "cursor": "Y3Vyc35Cdz09fjU" }, "results": [ { "id": "YWVjZH5xcTdtR2JYNVV4NDNNVmJES3cwZGVuX0wyQ35QZk8ydzJudlNrV3UyMUFUOGNZRWNB", "name": "P50_Civic Center Federated SS.rvt", "alternativeRepresentations": { "fileUrn": "urn:adsk.wipprod:dm.lineage:PfO2w2nvSkWu21AT8cYEcA", "fileVersionUrn": "urn:adsk.wipprod:fs.file:vf.PfO2w2nvSkWu21AT8cYEcA?version=2" } }, { "id": "YWVjZH5xcTdtR2JYNVV4NDNNVmJES3cwZGVuX0wyQ343N3k3YzJpQlJELWxQeERUd3RXMldn", "name": "ZSmallOffice_56Elem_ft.rvt", "alternativeRepresentations": { "fileUrn": "urn:adsk.wipprod:dm.lineage:77y7c2iBRD-lPxDTwtW2Wg", "fileVersionUrn": "urn:adsk.wipprod:fs.file:vf.77y7c2iBRD-lPxDTwtW2Wg?version=2" } }, { "id": "YWVjZH5xcTdtR2JYNVV4NDNNVmJES3cwZGVuX0wyQ35fSnFPNTQxelJpZWpRZTJ4VXBHRlhR", "name": "Snowdon Towers Sample Architectural.rvt", "alternativeRepresentations": { "fileUrn": "urn:adsk.wipprod:dm.lineage:_JqO541zRiejQe2xUpGFXQ", "fileVersionUrn": "urn:adsk.wipprod:fs.file:vf._JqO541zRiejQe2xUpGFXQ?version=61" } }, { "id": "YWVjZH5xcTdtR2JYNVV4NDNNVmJES3cwZGVuX0wyQ35WSHlpYUJkd1FJbXNLUmVZOU9TQmdB", "name": "Snowdon Towers Sample Architectural.rvt", "alternativeRepresentations": { "fileUrn": "urn:adsk.wipprod:dm.lineage:VHyiaBdwQImsKReY9OSBgA", "fileVersionUrn": "urn:adsk.wipprod:fs.file:vf.VHyiaBdwQImsKReY9OSBgA?version=18" } }, { "id": "YWVjZH5xcTdtR2JYNVV4NDNNVmJES3cwZGVuX0wyQ35KMkxjMnl2Q1JBeUUxdEpybXg1UDNR", "name": "Snowdon Towers Sample Architectural.rvt", "alternativeRepresentations": { "fileUrn": "urn:adsk.wipprod:dm.lineage:J2Lc2yvCRAyE1tJrmx5P3Q", "fileVersionUrn": "urn:adsk.wipprod:fs.file:vf.J2Lc2yvCRAyE1tJrmx5P3Q?version=1" } } ] } } }
Show More
Note down the ID of the design that you wish to use. You will need this ID for the remaining tasks. For illustration, in this tutorial we have used the ID of the design named Snowdon Towers Sample Architectural.rvt
.
After working through the steps mentioned above, you should see a screen similar to the following image: