- URL:
- https://[root]/content/users/[userName]/createService
- Methods:
POST
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 |
---|---|
| For a complete listing, see Common parameters. |
| A JSON object specifying the properties of the newly created service. See the createParameters properties table below for further information. |
| The newly created service type. Example
|
| A user-friendly description for the service. |
| An array of user-defined tags that describe the service. |
| A short summary description of the service. |
| If Values: |
| 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: |
| The response format. The default response format is Values: |
createParameters properties
The create
JSON object is described in the table below. All properties are optional unless marked as required.
Property | Description |
---|---|
(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:
|
| Description given to the service. |
| Boolean value indicating whether the data changes. Values: |
| A double value indicating any constraints enforced on query operations. Example:
|
| The formats in which query results are returned. Example:
|
| Specify feature service editing capabilities. Values: |
| A user-friendly description for the published dataset. |
| Copyright information associated with the dataset. |
| 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:
|
| The initial extent set for the service. Example:
|
| Boolean value indicating if updating the geometry of the service is permitted. Values: |
| Units used by the feature service. Example:
|
| A JSON object specifying the properties of cross-site scripting prevention. See the xxsPreventionInfo properties table below. Example:
|
xxsPreventionInfo properties
Property | Description |
---|---|
| Boolean value indicating whether cross-site scripting prevention is enabled. Values: |
| Specifies the prevention rule. Values: |
| Specifies the input rule. Values: |
Response properties
Property | Details |
---|---|
| The encoded URL to the hosted service. Example:
|
| The unique ID for this item. Example:
|
| Name of the service item. Example:
|
| The ID of the new service item. Example:
|
| The URL to the hosted service. Example:
|
| The size of the item. Example:
|
| Indicates if the operation was successful. Example:
|
| The type of service created. Example:
|
| The description of the new service item. Example:
|
| The tags used to describe the service item. Example:
|
| 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"
}