- URL:https://[root]/content/users/[userName]/createService(POST only)
Example usage
The following is a sample ArcGIS Online POST request for the createService operation:
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:
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
Parameter | Details |
---|---|
[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
|
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.
Property | Description |
---|---|
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
|
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
|
supportedQueryFormats | The formats in which query results are returned. Example
|
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
|
initialExtent | The initial extent set for the service. Example
|
allowGeometryUpdates | Boolean value indicating if updating the geometry of the service is permitted. Values: true | false |
units | Units used by the feature service. Example
|
xssPreventionInfo | A JSON object specifying the properties of cross-site scripting prevention. See the xxsPreventionInfo properties table below. Example
|
Caution:
The feature service fullExtent is a union of all its layers' extents. Adding a new layer to an existing feature service changes the feature service's fullExtent to include the new layer extent.
xxsPreventionInfo properties
Property | Description |
---|---|
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
Property | Details |
---|---|
encodedServiceURL | The encoded URL to the hosted service. Example
|
itemId | The unique ID for this item. Example
|
name | Name of the service item. Example
|
serviceItemId | The ID of the new service item. Example
|
serviceurl | The URL to the hosted service. Example
|
size | The size of the item. Example
|
success | Indicates if the operation was successful. Example
|
type | The type of service created. Example
|
description | The description of the new service item. Example
|
tags | The tags used to describe the service item. Example
|
snippet | Snippet or summary for the new service item. Example
|
JSON Response syntax
{
"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
{
"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"
}