Search code examples
autodesk-forgeautodesk-bim360

Access files located in the WIP folder of BIM360 Design (old C4R)


We have a requirement from one of our clients to access the project files that are stored in the BIM360 Design (old Collaboration for Revit - C4R). I can not find any information in the developer pages of the Forge APIs that points to this location. I assume such an API is not part of Forge, but we were wondering if there is any other API that can provide those files. The exact requirements are:

  • Constantly monitor for changes on the files located there.
  • When changes occur, retrieve and backup all those files to a local machine.

The question is, how, if possible, can we access the project files located at the BIM360 Design cloud?


UPDATE (10/04/2018)

We have found these commands - specifically PublishModel and GetPublishModelJob. This does something, we can at the very least prompt the publication on demand, without the need for Revit. It is not clear to me when the items:autodesk.bim360:C4RModel pseudo-file is created. On top of that, the API does not appear to be able to receive a prefered output folder, which makes it really cumbersome to work for the intended purpose of backing up the information inside BIM360 Design.

UPDATE (25/04/2018)

We have tried using both commands (PublishJob and GetPublishModelJob). We have impersonated a Project Admin (via the x-user-id) but Forge is returning a 401 error (which is not even documented). The following (with a redacted documentID) is what we have tried:

{
    "jsonapi": {
      "version": "1.0"
    },
    "data": {
      "type": "commands",
      "attributes": {
        "extension": {
          "type": "commands:autodesk.bim360:C4RModelGetPublishJob",
          "version": "1.0.0"
      }
    },
    "relationships": {
      "resources": {
        "data": [ { "type": "items", "id": "<document_id>" } ]
      }
    }
  }
}

And this is Forge's response:

{
    "jsonapi": {
        "version": "1.0"
    },
    "errors": [
        {
            "id": "a4547153-1fd4-4710-b0d1-a7184d9e7e22",
            "status": "401",
            "code": "C4R",
            "detail": "Failed to get publish model job"
        }
    ]
}

Any thoughts?


Solution

  • After discussing with @tfrascaroli in Forge Help channel, we found the root cause of this error is caused by the incorrect value of x-user-id, so he didn't have the right permission to push the latest version of the C4R model to BIM360 docs.

    {
        "jsonapi": {
            "version": "1.0"
        },
        "errors": [
            {
                "id": "a4547153-1fd4-4710-b0d1-a7184d9e7e22",
                "status": "401",
                "code": "C4R",
                "detail": "Failed to get publish model job"
            }
        ]
    }
    

    The x-user-id is not a GUID and not the id we saw in the response of GET users or GET users/:user_id, it should be the value of the uid. After replacing the x-user-id value by the uid, the error doesn't show up again.

    [
      {
        "id": "a75e8769-621e-40b6-a524-0cffdd2f784e",  //!<<< We didn't use it for `x-user-id`
        "account_id": "9dbb160e-b904-458b-bc5c-ed184687592d",
        "status": "active",
        "role": "account_admin",
        "company_id": "28e4e819-8ab2-432c-b3fb-3a94b53a91cd",
        "company_name": "Autodesk",
        "last_sign_in": "2016-04-05T07:27:20.858Z",
        "email": "john.smith@mail.com",
        "name": "John Smith",
        "nickname": "Johnny",
        "first_name": "John",
        "last_name": "Smith",
        "uid": "L9EBJKCGCXBB",   //!<<<<< Here is the value for the x-user-id
        "image_url": "http://static-dc.autodesk.net/etc/designs/v201412151200/autodesk/adsk-design/images/autodesk_header_logo_140x23.png",
        "address_line_1": "The Fifth Avenue",
        "address_line_2": "#301",
        "city": "New York",
        "postal_code": "10011",
        "state_or_province": "New York",
        "country": "United States",
        "phone": "(634)329-2353",
        "company": "Autodesk",
        "job_title": "Software Developer",
        "industry": "IT",
        "about_me": "Nothing here",
        "created_at": "2015-06-26T14:47:39.458Z",
        "updated_at": "2016-04-07T07:15:29.261Z"
      }
    ]