Skip to content

Truncate (Feature Layer)

URL:
https://<adminservicecatalog-url>/services/<serviceName>/FeatureServer/<layerId>/truncate
Methods:
POST

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. The operation 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. As well, the operation does not change the schema of the data (does not add, remove, or alter existing database columns, constraints, or indexes).

Request parameters

ParameterDetails
attachmentOnly

Deletes all the attachments for this layer. None of the layer features will be deleted when attachmentOnly=true .

Value: true | false

async

Supports options for asynchronous processing. The default format is false . It is recommended to set async=true for larger datasets.

Value: true | false

f

The response format. The default response format is html .

Values: html | json | pjson

Example usage

Below is a sample URL used to access the truncate operation:

Use dark colors for code blocksCopy
1
https://services.myserver.com/OrgID/ArcGIS/admin/services/countries-truncate.FeatureServer/0/truncate

JSON Response syntax

When attachmentOnly=true

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
{
  "success": <true|false>,
  "error": {
    "code": <code>,
    "message": "<description>",
    "details": [
      "<message>"
    ]
  }
}

JSON response example

When truncate succeeds

Use dark colors for code blocksCopy
1
2
3
{
  "success": true
}

When truncate fails

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
{
  "error": {
    "code": 400,
    "message": "",
    "details": [
      "Unable to truncate layer data."
    ]
  }
}

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.