/createService: Create Service

URL:
https://[root]/content/users/[userName]/createService
Methods:
POST

Example usage

The following is a sample ArcGIS Online POST request for the createService operation:

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
31
32
33
34
35
POST /sharing/rest/content/users/jsmith/createService HTTP/1.1
Host: org.arcgis.com
Content-Type: application/x-www-form-urlencoded
Content-Length: []

createParameters={
  "name": "EmptyServiceName",
  "serviceDescription": "",
  "hasStaticData": false,
  "maxRecordCount": 1000,
  "supportedQueryFormats": "JSON",
  "capabilities": "Create,Delete,Query,Update,Editing",
  "description": "",
  "copyrightText": "",
  "spatialReference": {
    "wkid": 102100
  },
  "initialExtent": {
    "xmin": -20037507.0671618,
    "ymin": -30240971.9583862,
    "xmax": 20037507.0671618,
    "ymax": 18398924.324645,
    "spatialReference": {
      "wkid": 102100,
      "latestWkid": 3857
    }
  },
  "allowGeometryUpdates": true,
  "units": "esriMeters",
  "xssPreventionInfo": {
    "xssPreventionEnabled": true,
    "xssPreventionRule": "input",
    "xssInputRule": "rejectInvalid"
  }
}&outputType=featureService&description=New Service&tags=empty, empty service&snippet=This is an empty service&f=pjson

The following is a sample ArcGIS Enterprise POST request for the createService operation:

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
31
32
33
34
35
POST /webadaptor/sharing/rest/content/users/jsmith/createService HTTP/1.1
Host: machine.domain.com
Content-Type: application/x-www-form-urlencoded
Content-Length: []

createParameters={
  "name": "EmptyServiceName",
  "serviceDescription": "",
  "hasStaticData": false,
  "maxRecordCount": 1000,
  "supportedQueryFormats": "JSON",
  "capabilities": "Create,Delete,Query,Update,Editing",
  "description": "",
  "copyrightText": "",
  "spatialReference": {
    "wkid": 102100
  },
  "initialExtent": {
    "xmin": -20037507.0671618,
    "ymin": -30240971.9583862,
    "xmax": 20037507.0671618,
    "ymax": 18398924.324645,
    "spatialReference": {
      "wkid": 102100,
      "latestWkid": 3857
    }
  },
  "allowGeometryUpdates": true,
  "units": "esriMeters",
  "xssPreventionInfo": {
    "xssPreventionEnabled": true,
    "xssPreventionRule": "input",
    "xssInputRule": "rejectInvalid"
  }
}&outputType=featureService&description=New Service&tags=empty, empty service&snippet=This is an empty service&f=pjson

Description

This operation allows users to create a hosted feature service. You can use the API to create an empty hosted feature service from a feature service metadata JSON.

Request parameters

ParameterDetails

[Common Parameters]

For a complete listing, see Common parameters.

createParameters

A JSON object specifying the properties of the newly created service. See the createParameters properties table below for further information.

outputType

The newly created service type.

Example

Use dark colors for code blocksCopy
1
outputType=featureService

description

A user-friendly description for the service.

tags

An array of user-defined tags that describe the service.

snippet

A short summary description of the service.

overwrite

If true, the service is overwritten. The default value is false.

Values: true | false

isView

Specifies if the request is generating a location tracking view. A view can only be created if there is already a Location Tracking Service that has been created.

Values: true | false

f

The response format. The default response format is json.

Values: html | json

createParameters properties

The createParameters JSON object is described in the table below. All properties are optional unless marked as required.

PropertyDescription

name

(Required)

Name of the service to be created. This name must be unique. If the name already exists, the operation will fail. ArcGIS Enterprise does not allow spaces or special characters other than underscores in a service name.

Example:

Use dark colors for code blocksCopy
1
"name": "EmptyServiceName"

serviceDescription

Description given to the service.

hasStaticData

Boolean value indicating whether the data changes.

Values: true | false

maxRecordCount

A double value indicating any constraints enforced on query operations.

Example:

Use dark colors for code blocksCopy
1
"maxRecordCount": 1000

supportedQueryFormats

The formats in which query results are returned.

Example:

Use dark colors for code blocksCopy
1
"supportedQueryFormats": "JSON"

capabilities

Specify feature service editing capabilities.

Values: Create | Delete | Query | Update | Sync

description

A user-friendly description for the published dataset.

copyrightText

Copyright information associated with the dataset.

spatialReference

All layers added to a hosted feature service need to have the same spatial reference defined for the feature service. When creating a new empty service without specifying its spatial reference, the spatial reference of the hosted feature service is set to the first layer added to that feature service.

Example:

Use dark colors for code blocksCopy
1
2
3
"spatialReference": {
  "wkid": 102100
}

initialExtent

The initial extent set for the service.

Example:

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
"initialExtent" : {
  "xmin" : -20037507.0671618,
  "ymin" : -30240971.9583862,
  "xmax" : 20037507.0671618,
  "ymax" : 18398924.324645,
  "spatialReference" : {
    "wkid" : 102100,
    "latestWkid" : 3857
  }
}

allowGeometryUpdates

Boolean value indicating if updating the geometry of the service is permitted.

Values: true | false

units

Units used by the feature service.

Example:

Use dark colors for code blocksCopy
1
"units": "esriMeters"

xssPreventionInfo

A JSON object specifying the properties of cross-site scripting prevention. See the xxsPreventionInfo properties table below.

Example:

Use dark colors for code blocksCopy
1
2
3
4
5
"xssPreventionInfo": {
  "xssPreventionEnabled": true,
  "xssPreventionRule": "input",
  "xssInputRule": "rejectInvalid"
}

xxsPreventionInfo properties

PropertyDescription

xssPreventionEnabled

Boolean value indicating whether cross-site scripting prevention is enabled.

Values: true | false

xssPreventionRule

Specifies the prevention rule.

Values: input | inputOutput

xssInputRule

Specifies the input rule.

Values: rejectInvalid | sanitizeInvalid

Response properties

PropertyDetails

encodedServiceURL

The encoded URL to the hosted service.

Example:

Use dark colors for code blocksCopy
1
2
"encodedServiceURL":"https://<server>.arcgis.com/J4hBlWAa0Sl7uI5e/arcgis/rest/services/NewServiceName/
                     FeatureServer"

itemId

The unique ID for this item.

Example:

Use dark colors for code blocksCopy
1
"itemId":"eb55f55e8f60419dbbccabb60ece2af8"

name

Name of the service item.

Example:

Use dark colors for code blocksCopy
1
"name":"NewServiceName"

serviceItemId

The ID of the new service item.

Example:

Use dark colors for code blocksCopy
1
"serviceItemId":"eb55f55e8f60419dbbccabb60ece2af8"

serviceurl

The URL to the hosted service.

Example:

Use dark colors for code blocksCopy
1
"serviceurl":"https://<server>.arcgis.com/J4hBlWAa0Sl7uI5e/arcgis/rest/services/NewServiceName/FeatureServer"

size

The size of the item.

Example:

Use dark colors for code blocksCopy
1
"size":-1

success

Indicates if the operation was successful.

Example:

Use dark colors for code blocksCopy
1
"success":true

type

The type of service created.

Example:

Use dark colors for code blocksCopy
1
"type":"Feature Service"

description

The description of the new service item.

Example:

Use dark colors for code blocksCopy
1
"description":"New Service"

tags

The tags used to describe the service item.

Example:

Use dark colors for code blocksCopy
1
"tags":"Empty service"

snippet

Snippet or summary for the new service item.

Example:

Use dark colors for code blocksCopy
1
"snippet":"This is an empty service"

JSON Response syntax

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
{
  "encodedServiceURL": <URL>,
  "itemId": "<item id>",
  "name": "<name of new service>",
  "serviceItemId": "<service id>",
  "serviceurl": "<url of service>",
  "size": "<size of new service>",
  "success": true | false,
  "type": "Feature Service",
  "description": "<description of the new service>",
  "tags": "<tags used for service>",
  "snippet": "<snippet given for service>"
}

JSON Response example

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
{
  "encodedServiceURL":"https://<server>.arcgis.com/J4hBlWAa0Sl7uI5e/arcgis/rest/services/NewServiceName/FeatureServer",
  "itemId":"eb55f55e8f60419dbbccabb60ece2af8",
  "name":"NewServiceName",
  "serviceItemId":"eb55f55e8f60419dbbccabb60ece2af8",
  "serviceurl":"https://<server>.arcgis.com/J4hBlWAa0Sl7uI5e/arcgis/rest/services/NewServiceName/FeatureServer",
  "size":-1,
  "success":true,
  "type":"Feature Service",
  "description":"New Service",
  "tags":"Empty service",
  "snippet":"This is an empty service"
}

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