Truncate (Feature Layer)
- URL:https://<adminservicecatalog-url>/services/<serviceName>/FeatureServer/<layerId>/truncate(POST only)
Description
The truncate operation supports deleting all features or attachments in a hosted feature service layer. The result of this operation is a response indicating success or failure with error code and description.

- Support for the truncate operation only applies if supportsTruncate is true on the layer metadata.
- Truncate is supported on the layer admin API and can be invoked by a user who can administer the service.
- The truncate operation does not return deleted ID's and will reset the auto-increment column Objectid to 1.
- The truncate operation does not change the schema of the data (does not add, remove, or alter existing database columns, constraints, or indexes).
- The following restrictions apply to the use of the layer truncate API:
- It cannot be used when the layer is an origin in relationships with other layers.
- It cannot be used to truncate layers that reference the same underlying database tables.
- It cannot be used when sync is enabled.
Request parameters
Parameter | Details |
---|---|
f | Description: The response format. The default response format is html. |
attachmentOnly | Description: Deletes all the attachments for this layer. None of the layer features will be deleted when attachmentOnly=true. Value: true | false Syntax: attachementsOnly:true |
async | Description: Supports options for asynchronous processing. The default format is false. It is recommended to set async=true for larger datasets. Value: true | false |
Example usage
- Example 1: Layer truncate
https://services.myserver.com/OrgID/ArcGIS/admin/services/countries-truncate.FeatureServer/0/truncate
JSON response syntax (when attachmentOnly=true)
{
"success": <true|false>,
"error": {
"code": <code>,
"message": "<description>",
"details": [
"<message>"
]
}
}
JSON response example (when truncate operation succeeds)
{
"success" : true
}
JSON response example (when truncate operation fails)
{
"error" :
{
"code" : 400,
"message" : "",
"details" : [
"Unable to truncate layer data."
]
}
}