Skip to content
URL:
https://<adminservicecatalog-url>/services/<serviceName>/FeatureServer/<layerId>/addToDefinition
Methods:
POST

Description

The addToDefinition operation supports adding a definition property in a hosted feature service layer. The result of this operation is a response indicating success or a response indicating failure with an error code and description. The parameter allows the creator to add a definition property to a hosted feature service layer.

Parameters

ParameterDetails
addToDefinitionThe addToDefinition parameter supports adding a definition property in a hosted feature service layer.
async

Supports options for asynchronous processing. The default format is false .

Values: true | false

f

The response format. The default response format is html .

Values: html | json | pjson

Example usage

The examples below are some of the definition properties that can be added to a hosted feature layer.

Use dark colors for code blocksCopy
1
https://services.myserver.com/OrgID/ArcGIS/rest/admin/services/example/FeatureServer/0/addToDefinition

Example one: Add fields to a feature service layer

Below is a sample JSON object for the addToDefinition parameter that demonstrates how to add fields to a feature service layer:

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
{
  "fields": [
    {
      "name": "GlobalID", 50/1
      "type": "esriFieldTypeGlobalID",
      "alias": "GlobalID",
      "nullable": false,
      "editable": false
    },
    {
      "name": "date1",
      "type": "esriFieldTypeDate",
      "alias": "date1",
      "nullable": true,
      "editable": false,
      "domain": null,
      "defaultValue": "GetDate() WITH VALUES"
    },
    {
      "name": "str2",
      "type": "esriFieldTypeString",
      "alias": "str2",
      "nullable": true,
      "editable": true,
      "domain": null,
      "defaultValue": "'A' WITH VALUES"
    }

  ]
}

Example two: Add indexes to a feature service layer

Below is a sample JSON object for the addToDefinition parameter that demonstrates how to add indexes to a feature service layer:

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
{
  "indexes": [
  {
    "name": "index1",
    "fields": "GlobalID, date1",
    "isUnique": false,
    "isAscending": false,
    "description": "index1"
  },
  {
    "name": "index2",
    "fields": "date1",
    "isUnique": false,
    "isAscending": false,
    "description": "index2"
  }
 ]
}

Example three: Add a non-clustered columnstore index

A non-clustered columnstore index help to improve the speed and efficiency of data retrieval. They act like a table of contents or catalog for large datasets, allowing you to quickly locate specific information. A columnstore index is a column oriented index structure optimized for very large analytical data.

ParameterDetails
name (Optional)The name of the columnstore index. If the name isn't defined, the system will create a name for it. The user can find the name in the layer's properties.
fields (Required)

The list of fields to be in the columnstore index.

description (Required)

The description of the index.

indexType (Required)

The value of the index type.

Values: ColumnStore

Below is a sample JSON syntex of a non-clustered columnstore index:

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
{
  "indexes" : [
    {
      "name" : "<name of the columnstore index",
      "fields": "<field1,field2,field3,...>",
      "description": "Description of the index",
      "indexType": "ColumnStore"
    }
  ]
}

Below is a sample JSON object that demonstrates how to add a non-clustered columnstore index:

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
{
  "indexes" : [
    {
      "name" : "IXC__ALLWEAR",
      "fields": "Qty,InvoiceDat,Customer,SalesAmtHo,GlobalID,Creator",
      "description": "it's a non-clustered ColumnStore",
      "indexType": "ColumnStore"
    }
  ]
}

JSON non-clustered columnstore index response examples

When addToDefinition non-clustered columnstore index succeeds: The URL is available to a 'addToDefinition' job endpoint.

Use dark colors for code blocksCopy
1
2
3
{
  "statusURL" : "https://services.myserver.com/myorgID/ArcGIS/rest/admin/services/serviceName/FeatureServer/0/addToDefinition/JobID"
}

This example is the response when addToDefinition non-clustered columnstore index succeeds.

Use dark colors for code blocksCopy
1
{"submissionTime":1758310905350,"lastUpdatedTime":1758310905937,"status":"Completed"}

This example is the response when addToDefinition non-clustered columnstore index fails.

Use dark colors for code blocksCopy
1
{"submissionTime":1758311440693,"lastUpdatedTime":1758311441010,"status":"Failed","error":{"code":500,"description":"Editing definition error - Parcels "}}

Add to definition JSON response examples

This example is the Add to definition JSON Response syntax

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>"
    ]
  }
}

This example is the response when addToDefinition succeeds.

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

This example is the response when addToDefinition fails:

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

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