Skip to navigation

Restore a Deleted Node in a Tree

View as Markdown

This tutorial demonstrates how to restore a deleted node in a classifications tree. The steps include retrieving the current tip-version nodes, reimporting the complete tree structure with the deleted node restored, and verifying that the node is no longer marked as deleted in the new tip version.

Before You Begin

  • Register an app.
  • Acquire a 3-legged OAuth token with the data:read, data:write, and data:create scopes.
  • Verify that you have access to the relevant account and Forma project and that you have Project Administrator permissions.
  • Find the relevant project ID by following the Retrieve a Project ID tutorial. In this example, assume the project ID is f6a1e3b5-abaa-4b01-b33a-5d55f36ba047.
  • Find the tree ID you want to update. In this example, assume the tree ID is 0295f158-6f95-7fb0-b008-4cde506166ee.

Step 1: Get Current Tip-Version Nodes (Including Deleted)

Call GET tip version nodes with includeDeleted=true to retrieve the current nodes in the tree, including deleted nodes.

Use the response to identify the node you want to restore.

Request

curl -v 'https://developer.api.autodesk.com/construction/classifications/v1/projects/f6a1e3b5-abaa-4b01-b33a-5d55f36ba047/trees/0295f158-6f95-7fb0-b008-4cde506166ee/versions/tip/nodes?includeDeleted=true&limit=1000&offset=0' \
-H 'Authorization: Bearer <3LO_TOKEN>'

Response

{
"results": [
{
"id": "019ed520-d6ae-71c6-9b57-78607a424d31",
"externalId": "019ed520-d6ae-71c6-9b57-78607a424d31",
"name": "Floor 1",
"nodeCode": "FLOOR-1",
"parentNodeId": null,
"parentNodeExternalId": null,
"order": 1,
"isDeleted": false
},
{
"id": "019ed520-d6ae-71c6-9b57-7cc74a5501be",
"externalId": "019ed520-d6ae-71c6-9b57-7cc74a5501be",
"name": "Room 101",
"nodeCode": "ROOM-101",
"parentNodeId": "019ed520-d6ae-71c6-9b57-78607a424d31",
"parentNodeExternalId": "019ed520-d6ae-71c6-9b57-78607a424d31",
"order": 1,
"isDeleted": false
},
{
"id": "019ed520-d6ae-71c6-9b57-8c2db7e8f79a",
"externalId": "019ed520-d6ae-71c6-9b57-8c2db7e8f79a",
"name": "Room 102",
"nodeCode": "ROOM-102",
"parentNodeId": "019ed520-d6ae-71c6-9b57-78607a424d31",
"parentNodeExternalId": "019ed520-d6ae-71c6-9b57-78607a424d31",
"order": 2,
"isDeleted": true
}
],
"pagination": {
"limit": 1000,
"offset": 0,
"totalResults": 3,
"nextUrl": null
}
}

In this example, assume you want to restore the node with code ROOM-102. Note its node ID, 019ed520-d6ae-71c6-9b57-8c2db7e8f79a.

The response returns a flat list of nodes. In the next step, you will convert the flat list into a nested tree structure and restore the node in the hierarchy.

Step 2: Reimport the Tree With the Deleted Node Restored

To restore the node, use the tree ID (0295f158-6f95-7fb0-b008-4cde506166ee) to call POST trees:reimport.

Provide the complete desired tree structure in importData, including the deleted node. In this example, ROOM-102 is restored to the hierarchy.

To restore the original node (instead of creating a new node), include the same node ID and place it under the same parent in the hierarchy. If you omit the original ID, a new node is created instead of restoring the deleted node.

Do not send the flat list of nodes returned in Step 1. Reimport expects a complete nested tree structure.

Request

curl -v 'https://developer.api.autodesk.com/construction/classifications/v1/projects/f6a1e3b5-abaa-4b01-b33a-5d55f36ba047/trees/0295f158-6f95-7fb0-b008-4cde506166ee:reimport' \
-X POST \
-H 'Authorization: Bearer <3LO_TOKEN>' \
-H 'Content-Type: application/json' \
-d '{
"name": "Locations",
"description": "Tree after restoring Room 102",
"importData": [
{
"id": "019ed520-d6ae-71c6-9b57-78607a424d31",
"name": "Floor 1",
"nodeCode": "FLOOR-1",
"children": [
{
"id": "019ed520-d6ae-71c6-9b57-7cc74a5501be",
"name": "Room 101",
"nodeCode": "ROOM-101"
},
{
"id": "019ed520-d6ae-71c6-9b57-8c2db7e8f79a",
"name": "Room 102",
"nodeCode": "ROOM-102"
}
]
}
]
}'

Response (201)

{
"id": "0295f158-6f95-7fb0-b008-4cde506166ee",
"name": "Locations",
"description": "Tree after restoring Room 102",
"isBasedOnAccountTree": false,
"treeConnectionType": "standalone",
"originalTreeId": null,
"createdAt": "2026-02-20T12:15:30.000Z",
"updatedAt": "2026-02-21T08:42:11.000Z",
"createdBy": "A3RGM375QTZ7",
"updatedBy": "A3RGM375QTZ7"
}

The tree has been reimported with the ROOM-102 node restored. In the next step, verify that the node is no longer marked as deleted in the new tip version.

Step 3: Verify the Node is Restored

Call GET tip version nodes to retrieve the nodes in the new tip version.

Verify that the restored node is returned with isDeleted set to false.

Request

curl -v 'https://developer.api.autodesk.com/construction/classifications/v1/projects/f6a1e3b5-abaa-4b01-b33a-5d55f36ba047/trees/0295f158-6f95-7fb0-b008-4cde506166ee/versions/tip/nodes?limit=1000&offset=0' \
-H 'Authorization: Bearer <3LO_TOKEN>'

Response

{
"results": [
{
"id": "019ed520-d6ae-71c6-9b57-78607a424d31",
"externalId": "019ed520-d6ae-71c6-9b57-78607a424d31",
"name": "Floor 1",
"nodeCode": "FLOOR-1",
"parentNodeId": null,
"parentNodeExternalId": null,
"order": 1,
"isDeleted": false
},
{
"id": "019ed520-d6ae-71c6-9b57-7cc74a5501be",
"externalId": "019ed520-d6ae-71c6-9b57-7cc74a5501be",
"name": "Room 101",
"nodeCode": "ROOM-101",
"parentNodeId": "019ed520-d6ae-71c6-9b57-78607a424d31",
"parentNodeExternalId": "019ed520-d6ae-71c6-9b57-78607a424d31",
"order": 1,
"isDeleted": false
},
{
"id": "019ed520-d6ae-71c6-9b57-8c2db7e8f79a",
"externalId": "019ed520-d6ae-71c6-9b57-8c2db7e8f79a",
"name": "Room 102",
"nodeCode": "ROOM-102",
"parentNodeId": "019ed520-d6ae-71c6-9b57-78607a424d31",
"parentNodeExternalId": "019ed520-d6ae-71c6-9b57-78607a424d31",
"order": 2,
"isDeleted": false
}
],
"pagination": {
"limit": 1000,
"offset": 0,
"totalResults": 3,
"nextUrl": null
}
}

The node is no longer marked as deleted in the latest tip version.

Congratulations! You have successfully restored a deleted node in a classifications tree.


Imported from the Autodesk Platform Services documentation: https://aps.autodesk.com/en/docs/acc/v1/tutorials/classifications/restore-node.