Find assets related to a given asset.
POST
v1/collections/{collectionId}/exchanges/{exchangeId}/assets:get-closure
Find the first layer of assets related to a starting asset. This API may return many assets and relationships, so use the GET Retrieve additional related assets API to retrieve additional assets.
Resource Information
Method and URI | POST https://developer.api.autodesk.com/exchange/v1/collections/{collectionId}/exchanges/{exchangeId}/assets:get-closure |
Authentication Context | app only |
Required OAuth Scopes | data:read |
Data Format | JSON |
Request
Headers
Authorization* string | Must be Bearer <token> , where <token> is obtained via OAuth |
Content-Type* string | Must be application/json |
* Required
Request
URI Parameters
collectionId string | The unique ID of the collection. |
exchangeId string | The unique ID of the exchange. |
Request
Query String Parameters
include array: string | If this query parameter is set as classification: type, category and family is provided as attributes of an asset |
Request
Body Structure
Expand all
startAssets* array: object | The start assets for closure traversals. The limit on the number of assets accepted depends on the response inclusion options. These limits are as follows: - When only_ids is requested, the limit is 40 - When only_ids are not requested, the limit is 20 |
assetId* string | The unique ID of the starting asset. |
relationshipFilters array: object | |
direction enum:string | The direction that the traversal should go in.
Possible values: OUT , IN |
include array: string | A list of options to control what is included in the response. The supported values are: only_ids, asset_attributes, asset_components, relationship_attributes, relationship_components. When undefined, the API returns the closure topology, assets, and relationships along with their attributes and components. When only_ids is supplied, the API returns IDs of the edges and nodes in the topology and ignores all other options. |
* Required
Response
HTTP Status Code Summary
200 OK | All related assets (nodes) and relationships (edges) were retrieved successfully. |
400 Bad Request | The request is invalid. |
401 Unauthorized | Invalid authorization header. |
403 Forbidden | Access denied regardless of authorization status. |
404 Not Found | The specified resource was not found. |
500 Internal Server Error | Unexpected service interruption. |
Response
Body Structure (200)
Expand all
topology object | Graph of all the relationships and assets that were computed by the closure query |
nodes array: object | A list of graph nodes representing assets related to the start asset(s). The limit on the number of nodes returned depends on the response inclusion options. These limits are as follows: - A maximum of 400 related asset nodes are returned when only_ids are requested for a single start asset - A maximum of 100 related asset nodes are returned for any other response include options - Nodes representing the start assets are always included in one of the response pages over the above limits |
assetId string | ID of the asset that is associated with the node |
snapshotContextId string | ID of the snapshot that was in the context when the traverser visited that node |
excluded enum:string | The reason why the node is marked as excluded
Possible values: READ_DENIED , DELETED , FILTERED |
assetInSnapshot boolean | If true, then the given asset is in the snapshot that was in context, and that version is returned. If false, then the asset is not in the snapshot that was in context, and the tip version of the asset is returned. |
edges array: object | A list of graph edges representing relationships originating to or from the start asset(s). The limit on the number of edges returned depends on the response inclusion options. These limits are as follows: - A maximum of 400 edges are returned when only_ids are requested for a single start asset - A maximum of 100 edges are returned for any other response include options |
relationshipId string | ID of the relationship that is associated with the edge |
fromNode string | ID of the starting asset node in the relationship |
toNode string | ID of the ending asset node in the relationship |
relationships array: object | All the relationships that are referred to in the topology at their respective tip (latest) version. The maximum size is 100 |
createdBy object | The information on the user or service that last modified the entity. |
userId string | The user ID that created / modified the entity. |
serviceId string | The service ID that created / modified the entity. |
date datetime: ISO 8601 | Timestamp in the following format: YYYY-MM-DDThh:mm:ss.sz . |
lastModifiedBy object | The information on the user or service that last modified the entity. |
userId string | The user ID that created / modified the entity. |
serviceId string | The service ID that created / modified the entity. |
date datetime: ISO 8601 | Timestamp in the following format: YYYY-MM-DDThh:mm:ss.sz . |
id string | The unique ID of the relationship |
type string | The type of the relationship, which is a combination of type name and type version |
from object | |
asset object | |
id string | The unique ID of the entity |
type string | The type of the entity |
url string | The URL to get the entity |
data object | The content of the entity |
snapshot object | |
id string | The unique ID of the entity |
type string | The type of the entity |
url string | The URL to get the entity |
data object | The content of the entity |
to object | |
asset object | |
id string | The unique ID of the entity |
type string | The type of the entity |
url string | The URL to get the entity |
data object | The content of the entity |
snapshot object | |
id string | The unique ID of the entity |
type string | The type of the entity |
url string | The URL to get the entity |
data object | The content of the entity |
category string | The category of the relationship. Possible values: Reference , Relationship . |
revisionId string | The ID of the latest revision of the relationship |
operation enum:string | The type of operation. Possible values: INSERT , MODIFY , REMOVE . |
attributes object | |
name string | The name of the attribute |
value string | The value of the attribute |
category string | The category of the attribute. Possible values: system , application , internal . |
components object | All components associated with this exchange |
id string | The unique ID of the entity |
url string | The relative URL to get the entity’s components |
data object | See HFDM Schema Specification 1.0 - Change Sets |
insert object | Components to be inserted |
* object | Components to be inserted |
modify object | Components to be modified |
* object | Components to be modified |
remove array: string | Component IDs to be removed |
assets array: object | All the revisioned assets that are referred to in the topology. Some of them (e.g., ID, version, typeId) might be partially populated if filtered, read-denied, or deleted. The maximum size is 100 related assets. The details of the starting asset(s) are returned over this limit. |
createdBy object | The information on the user or service that last modified the entity. |
userId string | The user ID that created / modified the entity. |
serviceId string | The service ID that created / modified the entity. |
date datetime: ISO 8601 | Timestamp in the following format: YYYY-MM-DDThh:mm:ss.sz . |
lastModifiedBy object | The information on the user or service that last modified the entity. |
userId string | The user ID that created / modified the entity. |
serviceId string | The service ID that created / modified the entity. |
date datetime: ISO 8601 | Timestamp in the following format: YYYY-MM-DDThh:mm:ss.sz . |
id string | The unique ID of the asset |
revisionId string | The ID of the latest revision of the asset |
type string | The type of the asset, which is a combination of type name and type version |
space object | |
id string | The unique ID of the entity |
type string | The type of the entity |
url string | The URL to get the entity |
data object | The content of the entity |
attributes object | All attributes associated with this exchange |
id string | The unique id of the attribute |
url string | |
data array: object | |
name string | The name of the attribute |
value string | The value of the attribute |
category string | The category of the attribute. Possible values: system , application , internal . |
components object | All components associated with this exchange |
id string | The unique ID of the entity |
url string | The relative URL to get the entity’s components |
data object | See HFDM Schema Specification 1.0 - Change Sets |
insert object | Components to be inserted |
* object | Components to be inserted |
modify object | Components to be modified |
* object | Components to be modified |
remove array: string | Component IDs to be removed |
externalComponentHash string | Client-supplied ID derived from the components of an asset |
operation enum:string | The type of operation. Possible values: INSERT , MODIFY , REMOVE . |
traversedLevels int | The number of depth levels that have been traversed |
pagination object | The information on the pagination of the response |
limit int | Upper limit to the paginated results |
cursor string | Current cursor (or index) marking where you are in the paginated set |
nextUrl string | Next URL |
Example
All related assets (nodes) and relationships (edges) were retrieved successfully.
Request
curl -v 'https://developer.api.autodesk.com/exchange/v1/collections/:collectionId/exchanges/:exchangeId/assets:get-closure' \
-X 'POST' \
-H 'Authorization: Bearer AuIPTf4KYLTYGVnOHQ0cuolwCW2a' \
-H 'Content-Type: application/json' \
-d '{
"startAssets": [
{
"assetId": "5F1A0BDA83EA6234B960375CF4401917A5EC1050"
}
],
"relationshipFilters": [
{
"direction": "OUT or IN"
}
],
"include": [
"only_ids"
]
}'
Show More
Response
{
"topology": {
"nodes": [
{
"assetId": "5F1A0BDA83EA6234B960375CF4401917A5EC1050",
"snapshotContextId": "1665777201820_37d52f49-024e-3a65-88ec-31ff3b599988",
"excluded": "FILTERED",
"assetInSnapshot": true
}
],
"edges": [
{
"relationshipId": "f68a7f57-8907-4e4f-a1f8-c25eca699b04",
"fromNode": "5F1A0BDA83EA6234B960375CF4401917A5EC1050",
"toNode": "1AEA1421C0EAA05EB55652C1D05EE13E402F3CA0"
}
]
},
"relationships": [
{
"createdBy": {
"userId": "QTCWNHC87PKH",
"serviceId": "test-client-id",
"date": "2021-07-07T17:30:31.395476Z"
},
"lastModifiedBy": {
"userId": "QTCWNHC87PKH",
"serviceId": "test-client-id",
"date": "2021-07-07T17:30:31.395476Z"
},
"id": "f68a7f57-8907-4e4f-a1f8-c25eca699b04",
"type": "autodesk.design:relationship.containment-1.0.0",
"from": {
"asset": {
"id": "5F1A0BDA83EA6234B960375CF4401917A5EC1050",
"type": "autodesk.design:assets.instance-1.0.0",
"url": "/collections/co.l1Lf2-orRbW-3oDLHMvSxg/assets/5F1A0BDA83EA6234B960375CF4401917A5EC1050",
"data": {}
},
"snapshot": {
"id": "5F1A0BDA83EA6234B960375CF4401917A5EC1050",
"type": "autodesk.design:assets.instance-1.0.0",
"url": "/collections/co.l1Lf2-orRbW-3oDLHMvSxg/assets/5F1A0BDA83EA6234B960375CF4401917A5EC1050",
"data": {}
}
},
"to": {
"asset": {
"id": "5F1A0BDA83EA6234B960375CF4401917A5EC1050",
"type": "autodesk.design:assets.instance-1.0.0",
"url": "/collections/co.l1Lf2-orRbW-3oDLHMvSxg/assets/5F1A0BDA83EA6234B960375CF4401917A5EC1050",
"data": {}
},
"snapshot": {
"id": "5F1A0BDA83EA6234B960375CF4401917A5EC1050",
"type": "autodesk.design:assets.instance-1.0.0",
"url": "/collections/co.l1Lf2-orRbW-3oDLHMvSxg/assets/5F1A0BDA83EA6234B960375CF4401917A5EC1050",
"data": {}
}
},
"category": "Relationship",
"revisionId": "1665776300314_4cb0b7c5-65fb-3701-bf9b-b3db3f095587",
"operation": "INSERT",
"attributes": {
"name": "rootAssetId",
"value": "ec78857a-9831-3fdf-b598-8c7214a30d33_STABLE1",
"category": "application"
},
"components": {
"id": "entityId",
"url": "/entityType/entityId/components",
"data": {
"insert": {
"autodesk.fdx:test-1.0.0": {
"test": {
"String": {
"prop1": "value1",
"prop2": "value2"
}
}
}
},
"modify": {
"autodesk.fdx:test-1.0.0": {
"test": {
"String": {
"prop1": "value3"
}
}
}
},
"remove": [
"autodesk.fdx:test-1.0.0"
]
}
}
}
],
"assets": [
{
"createdBy": {
"userId": "QTCWNHC87PKH",
"serviceId": "test-client-id",
"date": "2021-07-07T17:30:31.395476Z"
},
"lastModifiedBy": {
"userId": "QTCWNHC87PKH",
"serviceId": "test-client-id",
"date": "2021-07-07T17:30:31.395476Z"
},
"id": "5F1A0BDA83EA6234B960375CF4401917A5EC1050",
"revisionId": "1665777201820_37d52f49-024e-3a65-88ec-31ff3b599988",
"type": "autodesk.design:assets.design-1.0.0",
"space": {
"id": "5F1A0BDA83EA6234B960375CF4401917A5EC1050",
"type": "autodesk.design:assets.instance-1.0.0",
"url": "/collections/co.l1Lf2-orRbW-3oDLHMvSxg/assets/5F1A0BDA83EA6234B960375CF4401917A5EC1050",
"data": {}
},
"attributes": {
"id": "976jvaa5-67c5-31e0-9b41-488cc9ff2ab4",
"url": "/exchanges/6e21c319-c9f3-3350-bb67-d103b401409d/attributes",
"data": [
{
"category": "Application",
"name": "sourceVersionUrn",
"value": "urn:adsk.wipqa:fs.file:vf.XV24N2BxRkmzL-iw45HUDQ?version=1"
}
]
},
"components": {
"id": "entityId",
"url": "/entityType/entityId/components",
"data": {
"insert": {
"autodesk.fdx:test-1.0.0": {
"test": {
"String": {
"prop1": "value1",
"prop2": "value2"
}
}
}
},
"modify": {
"autodesk.fdx:test-1.0.0": {
"test": {
"String": {
"prop1": "value3"
}
}
}
},
"remove": [
"autodesk.fdx:test-1.0.0"
]
}
},
"externalComponentHash": "DA21CBAE2C2A33FA21580A4CB07B3949E8C9E33D",
"operation": "INSERT"
}
],
"traversedLevels": 1,
"pagination": {
"limit": 95,
"cursor": "46daa630-5f1c-4e46-b004-b512ff3649ac",
"nextUrl": "/v1/collections/co.l1Lf2-orRbW-3oDLHMvSxg/exchanges/3f351bac-f192-3e8a-9eae-e7f71e55d65f/assets:sync?cursor=46daa630-5f1c-4e46-b004-b512ff3649ac"
}
}
Show More