autodesk-forgeautodesk-bim360autodesk-construction-cloud

ACC API Gives 404 Error When Trying to Update User Permissions Via a PATCH Call


When I make my call, I use the URI formula https://developer.api.autodesk.com/construction/admin/v1/projects/:projectId/users/:userId, where projectId is the ID of the project (gotten from GET accounts/{accountId}/projects) and userId is the user ID (gotten from GET projects/{projectId}/users). For the user ID, I have tried the id, autodeskId, and analyticsId and all of them produce the same result. I have also tried to use three different user IDs (from all three previously mentioned fields as well) and I always get the same 404 Not Found error.

For the user ID, I have tried the id, autodeskId, and analyticsId and all of them produce the same result. I have also tried to use three different user IDs (from all three previously mentioned fields as well) and I always get the same 404 Not Found error. All of this has been tried on an ACC project, not BIM360. Here is an example of one of the versions I tried.

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()
                'Read access token as bearer and make the 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)

                'Send the info and get status response back
                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

Solution

  • The URI https://developer.api.autodesk.com/construction/admin/v1/projects/:projectId/users/:userId should be only available for GET and PATCH request, not for POST, that should be the issue.