调用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
关键错误与解决方法
URI路径错误:代码中误用了
folders路径,但目标接口的正确路径是projects,这是导致404的核心原因。需将URI修正为:https://developer.api.autodesk.com/construction/admin/v1/projects/{AccProjectID}/users/{正确用户ID}用户ID参数错误:代码末尾拼接的是
AccAccountID(账户ID),而非从GET projects/{projectId}/users接口获取的用户ID,需替换为正确的用户ID值。额外验证项:
- 确认AccessToken拥有
account:user:manage权限,或对应ACC项目的用户管理权限 - 再次核对
projectId是否属于ACC项目(可通过GET accounts/{accountId}/projects接口返回的type字段确认)
- 确认AccessToken拥有
内容的提问来源于stack exchange,提问作者user24825591
相关产品推荐
相关产品推荐

