Request

Response

    Task 4 - Verify and Remove an Assignment

    In this task, you check which products a user holds, and then you remove the direct assignment that you created. You use the same removal to free a seat when a user leaves or no longer needs a product.

    By the end of this task you will be able to:

    • List the product assignments of a user.
    • Tell a direct assignment from an inherited one.
    • Remove a direct assignment.

    You will use the following operations in this task:

    OperationHTTP request
    List Assignments GET /teams/{team-id}/assignments
    Unassign Product DELETE /teams/{team-id}/assignments

    Step 1 - Verify the assignment

    List the assignments of the user. To narrow the list to one product, add the productId parameter.

    In Postman, run the Find one user/product assignment request.

    The request

    Postman sends this request with the collection’s authorization adding your access token. The following cURL command shows the structure of the request. You don’t need to run it.

    curl -X GET \
      'https://developer.api.autodesk.com/team-admin/v1/teams/<YOUR_TEAM_ID>/assignments?userId=<YOUR_USER_ID>&productId=<YOUR_PRODUCT_ID>' \
      -H 'Authorization: Bearer <YOUR_ACCESS_TOKEN>'
    

    Response

    Postman shows a response like this:

    {
      "data": [
        {
          "userId": "US1234567890",
          "email": "ada.lovelace@example.com",
          "teamId": "100001",
          "productId": "prod_8f3a1c9d7b2e",
          "productName": "Example Product Premium",
          "assignmentType": "DIRECT"
        }
      ]
    }
    
    Show More

    Keep the following in mind:

    • Each user and product pair appears once. The assignmentType field shows how the user holds the product: TEAM (inherited from an assignment to the whole team), DIRECT (assigned to the user), or GROUP (inherited through a group). If a user holds the same product in more than one way, the field shows the first match in that order.
    • The response returns all matching assignments in one response, without pagination.
    • If you leave out both userId and productId, the response lists the assignments of the whole team. Changes can take a while to appear in this team-wide list.
    • A filter for a product the API doesn’t support, or for a user who isn’t on the team, returns an empty list.

    Step 2 - Remove the direct assignment

    Remove a direct assignment with the userId and productId query string parameters. The request has no body.

    Warning: This request removes a real assignment from a user.

    In Postman, run the Delete direct team assignment request.

    The request

    Postman sends this request with the collection’s authorization adding your access token. The following cURL command shows the structure of the request. You don’t need to run it.

    curl -X DELETE \
      'https://developer.api.autodesk.com/team-admin/v1/teams/<YOUR_TEAM_ID>/assignments?userId=<YOUR_USER_ID>&productId=<YOUR_PRODUCT_ID>' \
      -H 'Authorization: Bearer <YOUR_ACCESS_TOKEN>'
    

    Response

    A successful removal returns a 204 status code with no response body.

    Keep the following in mind:

    • You can remove direct assignments only. You can’t remove an assignment that a user inherits from a group or from the team.
    • If the user has no direct or inherited assignment for the product, including when you repeat a successful deletion, the request returns a 404 status code.
    • Removing a direct assignment keeps any inherited access. If only inherited access remains, a repeated request returns a 422 status code. To change inherited access, change the group or team assignment in Autodesk Account.

    See also