如何在Postman上发布BIM360的POST或PATCH用户角色和access_level [英] How to POST or PATCH users role and access_level for BIM360 on Postman

查看:89
本文介绍了如何在Postman上发布BIM360的POST或PATCH用户角色和access_level的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通过遵循本教程,我已经成功创建了一个新的 Account User : https://forge.autodesk.com/zh-CN/docs/bim360/v1/reference/http/projects-project_id-users-user_id-PATCH/

我也尝试按照下面的下一个链接将用户添加到项目中,但是我收到无法确定如何修复的错误.

https://forge.autodesk.com/zh-CN/docs/bim360/v1/reference/http/projects-project_id-users-import-POST/

URI: https://developer.api.autodesk.com/hq/v2/accounts/:account_id/projects/:project_id/users/import

方法: PATCH

授权:*********************************************

内容类型: application/json

x用户ID: {{user_id}}

身体:

  {"email":"john.smith@mail.com",服务": {文件管理": {"access_level":"account_admin"}},"company_id":**************************************,"industry_roles":[****************************************]} 

( industry_role 的ID为IT)

错误:

  {代码":1004,"message":该用户不存在."} 

我不确定如何得到此错误,因为用于 x-user-id 的用户ID与与 email 相关的 user_id 代码>在请求正文中给出.有没有办法解决这个问题或我可以使用的另一种方法?

解决方案

x-user-id 标头不是用于指定要导入的用户,而是:

x-user-id细绳在两足身份验证的情况下,该应用程序可以访问管理员在SaaS集成UI中指定的所有用户.通过提供此标头,API调用将被限制为仅代表指定的用户执行操作.

如果这不是您想要的内容,请删除该字段.

通过/GET users:userid .

并确保提供用户的电子邮件或用户ID,并且不要同时提供它们:

请注意,您需要指定电子邮件或user_id.但是,您不能同时指定两者.

请参阅文档https://forge.autodesk.com/en/docs/bim360/v1/reference/http/users-POST/#example, and have used the PATCH method to set their status to active on Postman.

I would like to set their role and access_level but I am having trouble doing so. I have followed the link below to try and perform this function, but it requires the user to already be a BIM 360 Project Admin for it to work.

https://forge.autodesk.com/en/docs/bim360/v1/reference/http/projects-project_id-users-user_id-PATCH/

I also tried following the next link below to add a User to a project, but I am getting errors that I am unsure how to fix.

https://forge.autodesk.com/en/docs/bim360/v1/reference/http/projects-project_id-users-import-POST/

URI: https://developer.api.autodesk.com/hq/v2/accounts/:account_id/projects/:project_id/users/import

Method: PATCH

Authorization: *******************************************

Content-Type: application/json

x-user-id: {{user_id}}

Body:

{
  "email": "john.smith@mail.com",
  "services": {
  "document_management": {
      "access_level": "account_admin"
    }
  },
  "company_id": ************************************,
  "industry_roles": [
    ************************************
  ]
}

(The id for industry_role is IT).

Error:

{
  "code": 1004,
  "message": "this user doesn't exist."
}

I am unsure how I am getting this error since the User Id used for x-user-id is the same user_id associated with the email given in the request body. Is there a way to fix this or another method I can use?

解决方案

The x-user-id header is not for specifying the user to import but rather:

x-user-id string In a two-legged authentication context, the app has access to all users specified by the administrator in the SaaS integrations UI. By providing this header, the API call will be limited to act on behalf of only the user specified.

Remove this field if that's not what you intended.

Verify the user id and email match each other via /GET users and /GET users:userid.

And be sure to provide either the user's email or the user ID and don't provide them both:

Note that you need to specify either an email, or a user_id. However, you cannot specify both.

See doc here

这篇关于如何在Postman上发布BIM360的POST或PATCH用户角色和access_level的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆