- URL:
- https://<knowledgegraphserver_graph-url>/truncate
- Methods:
POST- Version Introduced:
- 12.2
Description
The truncate operation is performed on a knowledge service's /graph resource. This operation allows users to permanently remove graph data from a knowledge graph service. It is designed to efficiently delete large volumes of data without requiring clients to first enumerate and delete individual entities or relationships. It can be used to remove all entities and relationships associated with a specific named type, or to remove all data in the graph, while preserving the data model.
The truncate operation is strictly asynchronous, where multiple truncate requests may run concurrently given each request is for a mutually exclusive named type. In the event multiple requests are operating on not mutually exclusive types, or if provenance is enabled, the requests are serialized.
Additionally, given that the asynchronous truncate operation and the synchronous apply operation are both performed on the knowledge service's graph resource, conflicts may occur depending on the timing of each request. As a result, the incoming operation request will fail when a conflicting operation is in progress. For example, if a truncate operation is in progress, any apply request will be rejected.
Administrative clients and owners of the knowledge graph service can always perform this operation. The user must have sufficient privileges to edit content and editing must be enabled for the knowledge graph service for this operation to be successful. You can enable editing for a knowledge graph service in the same way that you enable it for a hosted feature layer. The knowledge graph service's strict property must not be set to true, which indicates the data model cannot be modified.
The truncate operation is not supported for a knowledge graph service with the sync feature enabled.
Request parameters
| Parameter | Details |
|---|---|
(Required) | The data associated with a single named type, or all graph data, to be deleted. |
| The response format. The default format is Values: |
Example workflow
Below is a sample workflow to truncate all entities from the entity type Example from a knowledge graph service named Supply using html responses:
-
Submit a truncate job using a request URL:
Use dark colors for code blocks Copy https://organization.example.com/<context>/rest/services/Hosted/SupplyChain/KnowledgeGraphServer/graph/truncate?f=html -
Access the
jobstatus URL:Use dark colors for code blocks Copy https://organization.example.com/<context>/rest/services/Hosted/SupplyChain/KnowledgeGraphServer/jobs/<jobId>/status?f=html -
When the job is completed successfully, the
resultscan be used to access theUrl jobresults.Use dark colors for code blocks Copy resultsUrl: https://organization.example.com/<context>/rest/services/Hosted/SupplyChain/KnowledgeGraphServer/jobs/<jobId>/results?f=html asyncStatus: ASYNC_STATUS_COMPLETED progressStatus: code: 114716 message: Completed truncating the entity or relationship type 'ExampleEntityType1'. messages: EXECUTING starttime: 2026-08-27T20:21:37.623375010Z EXECUTING starttime: 2026-08-27T20:21:37.626499802Z Started truncating the entity or relationship type 'ExampleEntityType1'. Cascade deleting relationship type: 'Related_to'. Cascade deleted relationships in 'Related_to': 1. Completed truncating the entity or relationship type 'ExampleEntityType1'. COMPLETED endtime: 2026-08-27T20:21:37.669Z lastUpdatedTime: 1787862097669 submissionTime: 1787862097625 -
View job results for the completed truncate operation:
Use dark colors for code blocks Copy completionTime: 1787862097669 truncateResult: statistics: ExampleEntityType1: deletedCount: 5 typeCategory: esriTypeEntity Related_to: cascadeDeleted: true deletedCount: 1 typeCategory: esriTypeRelationship submissionTime: 1787862097623
Requests and responses
This operation can also be performed by sending a PBF-formatted request and receiving a PBF-formatted response. The status of the operation can be queried using a PBF-formatted response. Details of the request and response parameters are provided in the appropriate .proto files.
PBF Request
Create a PBF-formatted request to perform this operation based on the Truncate file.
PBF Response
Create a PBF-formatted response to query the status of the operation based on the Async file.
Once the operation is complete, get the truncate results using the results in the PBF-formatted response based on the Truncate file.