You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

调用PATCH接口更新ACC API用户权限时返回404错误

调用ACC用户管理接口返回404 Not Found问题排查

问题背景

  • 目标接口:https://developer.api.autodesk.com/construction/admin/v1/projects/:projectId/users/:userId
  • 参数来源:
    • projectId 取自 GET accounts/{accountId}/projects 接口返回结果
    • userId 取自 GET projects/{projectId}/users 接口返回结果
  • 尝试情况:分别使用id、autodeskId、analyticsId三种用户ID,测试三个不同用户,均返回404 Not Found错误
  • 操作范围:仅针对ACC项目,未涉及BIM360项目

测试代码(VB.NET)

Dim page As String = "https://developer.api.autodesk.com/construction/admin/v1/folders/" & AccProjectID & "/users/" & AccAccountID

Dim ErrorDetected As Boolean = False

Try
    Using client As HttpClient = New HttpClient()
        '读取AccessToken作为Bearer认证,设置Content Type为application/json
        client.DefaultRequestHeaders.Authorization = New AuthenticationHeaderValue("Bearer", AccAccessToken)
        client.DefaultRequestHeaders.Accept.Add(New MediaTypeWithQualityHeaderValue("application/json"))
        client.DefaultRequestHeaders.Add("User-Id", AdminAccAccountID)

        '发送请求并获取响应状态
        Dim RestContent As New Http.StringContent(JsonData, Encoding.UTF8, "application/json")
        Dim RestResponse As Http.HttpResponseMessage = Await client.PostAsync(page, RestContent)
        Dim Result = RestResponse.StatusCode.ToString
    End Using

Catch ex As Exception
    ErrorDetected = True
End Try

关键错误与解决方法

  1. URI路径错误:代码中误用了folders路径,但目标接口的正确路径是projects,这是导致404的核心原因。需将URI修正为:

    https://developer.api.autodesk.com/construction/admin/v1/projects/{AccProjectID}/users/{正确用户ID}
    
  2. 用户ID参数错误:代码末尾拼接的是AccAccountID(账户ID),而非从GET projects/{projectId}/users接口获取的用户ID,需替换为正确的用户ID值。

  3. 额外验证项:

    • 确认AccessToken拥有account:user:manage权限,或对应ACC项目的用户管理权限
    • 再次核对projectId是否属于ACC项目(可通过GET accounts/{accountId}/projects接口返回的type字段确认)

内容的提问来源于stack exchange,提问作者user24825591

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.24 16:12:20