0

I am building a tool automatically scan a local folder and upload files to BIM360 Docs, with 2 legged authentification, so far files can already uploaded to BIM360 Docs using Forge Data Management API however the "updated by" field is empty. what i want to accomplish is load the current login user and set the current user's name as updated by.

I cannot find anywhere i can use from Forge API to set the "updated by", can anyone suggest?

Thanks a lot.

user698188
  • 61
  • 1
  • 2

2 Answers2

0

When you post/patch an item/version there are two fields you can specify that suit your needs - lastModifiedUserId and lastModifiedUserName:

"attributes": {
        "mimeType": "appplication/pdf",
        "displayName": "version-test.pdf",
        "name": "version-test.pdf",
        "extension": {
          "data": {
            "tempUrn": null,
            "storageType": "OSS",
            "properties": {},
            "storageUrn": "urn:adsk.objects:os.object:wip.dm.prod/3c8f6bbc-fe5c-4815-a92e-8b8635e7b1cb.pdf"
          },
          "version": "1.0",
          "type": "versions:autodesk.bim360:FileVersions",
          "schema": {
            "href": "/schema/v1/versions/versions%3Aautodesk.bim360%3AFileVersions-1.0"
          }
        },
        "createUserName": "John Doe",
        "createTime": "2016-04-01T11:09:03.000Z",
        "createUserId": "BW9RM76WZBGL",
        "lastModifiedUserName": "John Doe",
        "lastModifiedUserId": "BW9RM76WZBGL",
        "versionNumber": 2,
        "lastModifiedTime": "2016-04-01T11:11:18.000Z"
      },
      "type": "versions",
      "id": "urn:adsk.wipprod:fs.file:vf.d34fdsg3g?version=2",
      "links": {
        "self": {
          "href": "/data/v1/projects/b.6f8813fe-31a7-4440-bc63-d8ca97c856b4/versions/urn%3Aadsk.wipprod%3Afs.file%3Avf.b909RzMKR4mhc3O7UBY_8g%3Fversion%3D1"
        }
      }
Bryan Huang
  • 5,247
  • 2
  • 15
  • 20
0

Normally, we would suggest you to use 3 legged token to modify a file in BIM360 Docs, because that will keep track the users who made the modification to that file(updated by). Yes you can also use 2 legged token for file management in BIM360 for now, but this behaviour may change in the future, and we will clearly mention in our blog if it happens.

There is no user information for any changes to the BIM360 files with 2 legged token, but there is one way, follow the Upload Files to BIM 360 Document Managemen Tutorial, in Step 7 & 8, add the x-user-id parameter in the header as the following picture, you will see the last modified user is filled. enter image description here

Check this https://forge.autodesk.com/en/docs/bim360/v1/reference/http/users-GET/ if you want to know how to get the x-user-id information, should be uid(Autodesk ID).

Zhong Wu
  • 1,721
  • 1
  • 8
  • 9