How to retrieved linked document from a BIM360 issue payload?

226 views Asked by At

It's all said in the title but let me detail my problem:

I want to retrieve a document linked to a given BIM360 issue. So in that specific case I want to find "georef.dwg" (at least it's version URN storage on BIM360), knowing issue #31 or #32.

enter image description here

When I look at the payload from the GET issues/:id, here is what I see:

{
   "data":{
      "id":"0f84bfa2-43be-4761-8c84-ff5314fca382",
      "type":"quality_issues",
      "links":{
         "self":"https://developer.api.autodesk.com/issues/v1/containers/86fe431f-012b-4349-939e-cbb0788cfbba/quality-issues/0f84bfa2-43be-4761-8c84-ff5314fca382"
      },
      "attributes":{
         "created_at":"2020-09-24T13:45:02.754Z",
         "synced_at":"2020-09-24T13:45:02.759Z",
         "updated_at":"2020-09-24T13:45:02.756Z",
         "close_version":null,
         "closed_at":null,
         "closed_by":null,
         "created_by":"TT4KN3D3PWME",
         "opened_at":"2020-09-24T13:45:02.740Z",
         "opened_by":"TT4KN3D3PWME",
         "updated_by":"TT4KN3D3PWME",
         "starting_version":1,
         "title":"Issue for testing georeferencing",
         "description":"",
         "location_description":null,
         "markup_metadata":null,
         "tags":null,
         "target_urn":"urn:adsk.wipprod:dm.lineage:BAu6NmpZRyW913SLf6J6IA",
         "target_urn_page":null,
         "collection_urn":null,
         "due_date":"2020-09-30T00:00:00.000Z",
         "identifier":30,
         "status":"open",
         "assigned_to":"201007062239661",
         "assigned_to_type":"user",
         "answer":null,
         "answered_at":null,
         "answered_by":null,
         "pushpin_attributes":{
            "type":"TwoDRasterPushpin",
            "location":{
               "x":5.710041960416264,
               "y":4.169567131777653,
               "z":0
            },
            "object_id":null,
            "viewer_state":null,
            "created_at":"2020-09-24T13:45:02.766Z",
            "created_by":"TT4KN3D3PWME",
            "created_doc_version":1,
            "external_id":null,
            "attributes_version":2
         },
         "snapshot_urn":"urn:adsk.objects:os.object:ng-issues-prod-86fe431f-012b-4349-939e-cbb0788cfbba/25881168-6246-4c32-9cc2-f31409ce519a",
         "owner":"TT4KN3D3PWME",
         "issue_type_id":null,
         "issue_type":null,
         "issue_sub_type":null,
         "root_cause_id":null,
         "root_cause":null,
         "quality_urns":null,
         "permitted_statuses":[
            "answered",
            "closed",
            "void"
         ],
         "permitted_attributes":[
            "answer",
            "assigned_to",
            "assigned_to_type",
            "description",
            "due_date",
            "location_description",
            "trades",
            "owner",
            "issue_type",
            "issue_type_id",
            "root_cause",
            "root_cause_id",
            "title",
            "status",
            "sheet_metadata",
            "lbs_location",
            "pushpin_attributes",
            "snapshot_urn",
            "close_version",
            "comments_attributes",
            "attachments_attributes",
            "markup_metadata",
            "updated_at",
            "tags",
            "collection_urn",
            "custom_attributes",
            "ng_issue_subtype_id"
         ],
         "comment_count":0,
         "attachment_count":0,
         "permitted_actions":[
            "add_comment",
            "add_attachment"
         ],
         "sheet_metadata":{
            "is3D":false,
            "sheetGuid":"6882be48-6626-5238-d3df-94e9f0a0019d",
            "sheetName":"2D View"
         },
         "lbs_location":null,
         "ng_issue_subtype_id":"1611f9cf-4ba0-43d0-af0b-0047499beb81",
         "ng_issue_type_id":"5830d615-c7fa-4aa3-8f9e-aa520176fa4d",
         "issue_template_id":null,
         "custom_attributes":[
            
         ],
         "trades":null,
         "comments_attributes":null,
         "attachments_attributes":null
      },
      "relationships":{
         "container":{
            "links":{
               "self":"https://developer.api.autodesk.com/issues/v1/containers/86fe431f-012b-4349-939e-cbb0788cfbba/quality-issues/0f84bfa2-43be-4761-8c84-ff5314fca382/relationships/container",
               "related":"https://developer.api.autodesk.com/issues/v1/containers/86fe431f-012b-4349-939e-cbb0788cfbba/quality-issues/0f84bfa2-43be-4761-8c84-ff5314fca382/container"
            }
         },
         "attachments":{
            "links":{
               "self":"https://developer.api.autodesk.com/issues/v1/containers/86fe431f-012b-4349-939e-cbb0788cfbba/quality-issues/0f84bfa2-43be-4761-8c84-ff5314fca382/relationships/attachments",
               "related":"https://developer.api.autodesk.com/issues/v1/containers/86fe431f-012b-4349-939e-cbb0788cfbba/quality-issues/0f84bfa2-43be-4761-8c84-ff5314fca382/attachments"
            }
         },
         "changesets":{
            "links":{
               "self":"https://developer.api.autodesk.com/issues/v1/containers/86fe431f-012b-4349-939e-cbb0788cfbba/quality-issues/0f84bfa2-43be-4761-8c84-ff5314fca382/relationships/changesets",
               "related":"https://developer.api.autodesk.com/issues/v1/containers/86fe431f-012b-4349-939e-cbb0788cfbba/quality-issues/0f84bfa2-43be-4761-8c84-ff5314fca382/changesets"
            }
         },
         "comments":{
            "links":{
               "self":"https://developer.api.autodesk.com/issues/v1/containers/86fe431f-012b-4349-939e-cbb0788cfbba/quality-issues/0f84bfa2-43be-4761-8c84-ff5314fca382/relationships/comments",
               "related":"https://developer.api.autodesk.com/issues/v1/containers/86fe431f-012b-4349-939e-cbb0788cfbba/quality-issues/0f84bfa2-43be-4761-8c84-ff5314fca382/comments"
            }
         },
         "activity_batches":{
            "links":{
               "self":"https://developer.api.autodesk.com/issues/v1/containers/86fe431f-012b-4349-939e-cbb0788cfbba/quality-issues/0f84bfa2-43be-4761-8c84-ff5314fca382/relationships/activity-batches",
               "related":"https://developer.api.autodesk.com/issues/v1/containers/86fe431f-012b-4349-939e-cbb0788cfbba/quality-issues/0f84bfa2-43be-4761-8c84-ff5314fca382/activity-batches"
            }
         },
         "root_cause_obj":{
            "links":{
               "self":"https://developer.api.autodesk.com/issues/v1/containers/86fe431f-012b-4349-939e-cbb0788cfbba/quality-issues/0f84bfa2-43be-4761-8c84-ff5314fca382/relationships/root-cause-obj",
               "related":"https://developer.api.autodesk.com/issues/v1/containers/86fe431f-012b-4349-939e-cbb0788cfbba/quality-issues/0f84bfa2-43be-4761-8c84-ff5314fca382/root-cause-obj"
            }
         },
         "issue_type_obj":{
            "links":{
               "self":"https://developer.api.autodesk.com/issues/v1/containers/86fe431f-012b-4349-939e-cbb0788cfbba/quality-issues/0f84bfa2-43be-4761-8c84-ff5314fca382/relationships/issue-type-obj",
               "related":"https://developer.api.autodesk.com/issues/v1/containers/86fe431f-012b-4349-939e-cbb0788cfbba/quality-issues/0f84bfa2-43be-4761-8c84-ff5314fca382/issue-type-obj"
            }
         }
      }
   }
}

I don't see any information there that allow me to retrieve "georef.dwg", but BIM360 obviously does... I see targetUrn but this isn't the URN of a BIM360 item version.

When I create an issue on a Revit file, then I get something in issue.attributes.pushpin_attributes.viewer_state.seedURN which seems to point to the correct version URN, but not when creating issues on dwg's.

1

There are 1 answers

2
cyrille On BEST ANSWER

the target_urn is the way to go. In this example, I create an issue on Drawing1.dwg on my account.

From BIM360docs folder content, I got this

{
    "id": "urn:adsk.wipprod:dm.lineage:_3AoTpMBQDm060PABvgQKg",
    "name": "Drawing1.dwg",
    "type": "items",
    "state": true,
    …
}

From the Issues API, I got the following: (I removed all irrelevant properties)

[
    {
        "created_at": "2020-10-01T14:05:06.524Z",
        "synced_at": "2020-10-01T14:05:06.528Z",
        …
        "starting_version": 6,
        "title": "cyrille",
        "target_urn": "urn:adsk.wipprod:dm.lineage:_3AoTpMBQDm060PABvgQKg",
        "target_urn_page": null,
        …
        "pushpin_attributes": {
            "type": "TwoDRasterPushpin",
            "location": {
                "x": 2.8286987422505243,
                "y": 5.8554650473401395,
                "z": 0
            },
            ….
        },
        …
        "sheet_metadata": {
            "is3D": false,
            "sheetGuid": "6882be48-1234-5238-d3df-94e9f000019d",
            "sheetName": "2D View"
        },
        ….
        "id": "ae09c72c-8236-6895-ba27-0141bf6aae97"
    }
]

See target_urn = urn:adsk.wipprod:dm.lineage:_3AoTpMBQDm060PABvgQKg, which match my item id = urn:adsk.wipprod:dm.lineage:_3AoTpMBQDm060PABvgQKg

starting_version will give you the BIM360docs item version you want.