autodesk forge – How can I get links between models on BIM 360?

After you get one version id of one file, you could call versions/:version_id/ relationships/refs. It will tell the relationships of this file with other files. In the structure, fromId is the root file, toId is the xref file. So, if fromId is same to the version_id, that means this file you are checking is a root file. Otherwise, it is one xref (linked) file.

And in the relationships, it will also tell the information of all xrefs file.

The below is the example with my test files.

Root file is urn:adsk.wipprod:fs.file:vf.z4KMn52OT5OIuKamXnzmFw?version=1

Linked file is
urn:adsk.wipprod:fs.file:vf.bIJqAo5-TrCmyMy07ELifw?version=1

Using version id of root file:

developer.api.autodesk.com/data/v1/projects/ /versions/ urn%3aadsk.wipprod%3afs.file%3avf.z4KMn52OT5OIuKamXnzmFw%3fversion%3d1/relationships/refs

it returns the structure:

  "data": [
    {
        "type": "versions",
        "id": "urn:adsk.wipprod:fs.file:vf.bIJqAo5-TrCmyMy07ELifw?version=1",
        "meta": {
            "refType": "xrefs",
            "fromId": "urn:adsk.wipprod:fs.file:vf.z4KMn52OT5OIuKamXnzmFw?version=1",
            "fromType": "versions",
            "toId": "urn:adsk.wipprod:fs.file:vf.bIJqAo5-TrCmyMy07ELifw?version=1",
            "toType": "versions",
            "direction": "from",
            "extension": {
                "type": "xrefs:autodesk.core:Xref",
                "version": "1.0",
                "schema": {
                    "href": "https://developer.api.autodesk.com/schema/v1/versions/xrefs:autodesk.core:Xref-1.0"
                },
                "data": {}
            }
        }
    }
],

Read more here: Source link