- URL:https://[root]/content/users/[userName]/publish
Example usage
The following is a sample ArcGIS Online request URL used to publish a shapefile:
https://www.arcgis.com/sharing/rest/content/users/jsmith/publish
Below is a sample ArcGIS Enterprise POST request used to demonstrate how to publish a shapefile:
POST /webadaptor/sharing/rest/content/users/jSmith/publish HTTP/1.1
Host: machine.domain.com
Content-Type: multipart/form-data; boundary=----boundary
Content-Length: []
------boundary
Content-Disposition: form-data; name="itemid"
345313e619df46f387f9ededbe15ac56
------boundary
Content-Disposition: form-data; name="file"; filename=""
Content-Type: application/octet-stream
------boundary
Content-Disposition: form-data; name="filetype"
shapefile
------boundary
Content-Disposition: form-data; name="publishParameters"
{"name":"Streets Service"}
------boundary
Content-Disposition: form-data; name="buildInitialCache"
false
------boundary
Content-Disposition: form-data; name="outputType"
------boundary
Content-Disposition: form-data; name="f"
json
------boundary--
Description
Publishes a hosted service based on an existing source item. Prior to publishing, items must be added using Add Item.
Publishers can create feature services as well as tiled map services. Feature services can be created using input files of type csv, excel, shapefile, serviceDefinition, geojson, sqliteGeodatabase, featureCollection, and fileGeodatabase.
- CSV and Microsoft Excel files (.xls, .xlsx) that contain location fields (for example, address fields or x,y fields) are spatially enabled during the process of publishing.
- Shapefiles and file geodatabases should be packaged as .zip files.
- Tiled map services can be created from service definition (.sd) files, tile packages, and existing feature services.
- Service definitions are authored in ArcGIS Pro and contain both the cartographic definition for a map and its packaged data together with the definition of the geoservice to be created.
- Vector tile packages (.vtpk) are created from a map (or a basemap) with the Create Vector Tile Package tool in ArcGIS Pro.
- Use the Analyze operation to generate the default publishing parameters for CSV files and Microsoft Excel files.
Request parameters
Parameter | Details |
---|---|
itemID | The ID of the item to be published. Example
|
file | The file to be uploaded. If uploading a file, the request must be a multipart request pursuant to IETF RFC1867. |
text |
The text in the file to be published. Nota:This parameter is only applicable to CSV, Microsoft Excel, and feature collection types. Syntax
|
fileType | Item type. Nota:imageCollection applies to ArcGIS Enterprise portal only. Values: serviceDefinition | shapefile | csv | excel | tilePackage | featureService | featureCollection | fileGeodatabase | geojson | scenepackage | vectortilepackage | imageCollection | mapService | sqliteGeodatabase |
publishParameters | A JSON object describing the service to be created as part of the publish operation. The appropriate value for publish parameters depends on the file type being published. For more information, see individual publisher parameter sections below. Nota:The publishParameters properties are optional when publishing a service definition (.sd), vector tile package (.vtpk), or tile package (.tpk) file. Example
|
outputType | Only used when a feature service is published as a tile service. Example
|
deleteSourceItemUponCompletion | If true, the source item will be deleted when publishing is complete. Used when overwriting hosted feature services published from a cloud drive (for example, Google Drive, Dropbox, and OneDrive) to prevent duplicate source item relates to the service. Values: true | false |
itemIdToCreate | New at 10.8.1. The item ID of the item. The item ID must not exist and must be 32 alphanumeric values. Nota:itemIdToCreate applies to ArcGIS Enterprise Portal only. Example
|
f | The response format. The default response format is json. Values: html | json | pjson |
CSV publish parameters JSON properties
The publishParameters JSON object used to publish a CSV file is described below.
Parameter | Details |
---|---|
type | Indicates a CSV file. Example
|
name (Required) | Name of the service to be created. The same name is reused as the name for the single layer within the service if the layerInfoparameter is not provided. Example
|
locationType (Required) | Specifies the data contained in the CSV or Excel file. If set as coordinates, the CSV or Excel data contains x,y information. If set as address, the CSV or Excel data contains address fields that will be geocoded to a single point. If set as lookup, the CSV or Excel data contains fields that can be mapped to well-known sets of geographies. If set to none, the CSV or Excel data contains no spatial content, and data will be loaded and subsequently queried as tabular data. Nota:Based on this parameter, additional parameters will be required. For example, when specifying coordinates as the locationType, the latitude and longitude fields below will need to be specified. Values: coordinates | address | lookup | none |
latitudeFieldName (Required if locationType is coordinates) | Specifies the name of the field that contains the y-coordinate. |
longitudeFieldName (Required if locationType is coordinates) | Specifies the name of the field that contains the x-coordinate. |
coordinateFieldType (Optional, used when locationType is coordinates) | Specifies the type of coordinates that contain location information. The default value is LatitudeAndLongitude. Values: LatitudeAndLongitude | MGRS | USNG |
coordinateFieldName (Optional, used when locationType is coordinates) | Indicates the name of the field that contains the coordinates specified in coordinateFieldType. |
addressTemplate (Required if locationType is address) | A string value that defines the address to find based on CSV or Excelfield values. Example
|
lookupType (Required if locationType is lookup) | The type of place to look up. |
lookupFields (Required if locationType is lookup) | A JSON object with name value pairs that define the fields used to look up the location. |
geocodeServiceUrl | The URL of the geocode service that supports batch geocoding. Example
|
sourceCountry | The two-character country code associated with the geocoding service. Example
|
sourceLocale | The locale used for the geocoding service source. Example
|
addressFields | A JSON object indicates the location fields mapping to the corresponding field names in the input dataset that contains spatial information for batch geocoding. Example
|
standardizedFieldNames | A JSON object indicates the standardized field names mapping in the geocode service given the country selected. Example
|
layerInfo (Required) | A JSON object that provides additional information about the dataset. The JSON format resembles the layerDescriptor used in publishing feature services to an on-premises spatial data server or ArcGIS Server. All parameters except fields are optional. Certain parameters such as geometryType and extent can be implied or calculated from the dataset. The objectId field is used as the name of the primary key column. If this field is a noneditable integer, the primary key is also made an autoincrementing column. If no objectId field is specified, an autoincrementing column named FID is used.
|
description | A description for the published dataset. |
maxRecordCount | A double value indicating any constraints enforced on query operations. The default is -1 or int.MaxValue indicating no constraint. Example
|
copyrightText | Copyright information associated with the dataset. |
columnNames | An array of column names, overridden if layerInfo fields is specified. If columnNames are omitted, the field names are inferred from the first line in the source CSV file. |
columnDelimiter | A delimiter between data fields in each row of text. The default is the comma character (,). Example
|
sourceSR | Spatial reference of the input coordinates. The default is WKID 4326. Example
|
targetSR | Target spatial reference of the coordinates as stored in the database. The default is WKID 102100. Example
|
editorTrackingInfo | A JSON object that specifies editor tracking information. Example
|
candidateFieldsType | Specifies the locator output fields. By default, only the location information (GeometryOnly) is included in the hosted feature layer. If set as Minimal, the CSV contains additional fields (location, status, score, match_addr, and addr_type) that describe the location and how well it matches the information in the location service. If set as AllFields, the CSV includes all available locator output fields in the hosted feature layer. Values: GeometryOnly | Minimal | AllFields |
dateFieldsTimeReference | A JSON object that specifies the data time zone information. Example
|
CSV publish parameters example
A sample publishParameters JSON object for a CSV file is as follows:
{
"type": "csv",
"name": "Offices",
"sourceUrl": "",
"locationType": "address",
"maxRecordCount": 2000,
"geocodeServiceUrl": "https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer",
"sourceCountry": "us",
"sourceLocale": "en",
"addressFields": {
"Address": "Street",
"City": "City",
"Region": "State",
"Postal": "Zip"
},
"standardizedFieldNames": {
"Address": "Street",
"City": "City",
"Region": "State",
"Postal": "ZIP",
"PostalExt": "ZIP4",
"CountryCode": "Country"
},
"columnDelimiter": ",",
"qualifier": "\"",
"targetSR": {
"wkid": 102100,
"latestWkid": 3857
},
"editorTrackingInfo": {
"enableEditorTracking": false,
"enableOwnershipAccessControl": false,
"allowOthersToQuery": true,
"allowOthersToUpdate": true,
"allowOthersToDelete": false,
"allowAnonymousToUpdate": true,
"allowAnonymousToDelete": true
},
"layerInfo": {
"currentVersion": 10.8,
"id": 0,
"name": "",
"type": "Table",
"displayField": "",
"description": "",
"copyrightText": "",
"defaultVisibility": true,
"relationships": [],
"isDataVersioned": false,
"supportsCalculate": true,
"supportsTruncate": false,
"supportsAttachmentsByUploadId": true,
"supportsRollbackOnFailureParameter": true,
"supportsStatistics": true,
"supportsAdvancedQueries": true,
"supportsValidateSql": true,
"supportsCoordinatesQuantization": true,
"supportsApplyEditsWithGlobalIds": false,
"advancedQueryCapabilities": {
"supportsPagination": true,
"supportsPaginationOnAggregatedQueries": true,
"supportsQueryRelatedPagination": true,
"supportsQueryWithDistance": true,
"supportsReturningQueryExtent": true,
"supportsStatistics": true,
"supportsOrderBy": true,
"supportsDistinct": true,
"supportsQueryWithResultType": true,
"supportsSqlExpression": true,
"supportsAdvancedQueryRelated": true,
"supportsReturningGeometryCentroid": false,
"supportsQueryWithDatumTransformation": true
},
"useStandardizedQueries": false,
"geometryType": "esriGeometryPoint",
"drawingInfo": {
"renderer": {
"type": "simple",
"symbol": {
"type": "esriPMS",
"url": "RedSphere.png",
"imageData": "iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAABGdBTUEAALGPASUVORK5CYII=",
"contentType": "image/png",
"width": 15,
"height": 15
}
}
},
"allowGeometryUpdates": true,
"hasAttachments": false,
"htmlPopupType": "",
"hasM": false,
"hasZ": false,
"globalIdField": "",
"typeIdField": "",
"fields": [
{
"name": "Name",
"type": "esriFieldTypeString",
"alias": "Name",
"sqlType": "sqlTypeNVarchar",
"length": 256,
"nullable": true,
"editable": true,
"domain": null,
"defaultValue": null,
"locationType": "unknown"
},
{
"name": "Street",
"type": "esriFieldTypeString",
"alias": "Street",
"sqlType": "sqlTypeNVarchar",
"length": 256,
"nullable": true,
"editable": true,
"domain": null,
"defaultValue": null,
"locationType": "Address"
},
{
"name": "City",
"type": "esriFieldTypeString",
"alias": "City",
"sqlType": "sqlTypeNVarchar",
"length": 256,
"nullable": true,
"editable": true,
"domain": null,
"defaultValue": null,
"locationType": "City"
},
{
"name": "State",
"type": "esriFieldTypeString",
"alias": "State",
"sqlType": "sqlTypeNVarchar",
"length": 256,
"nullable": true,
"editable": true,
"domain": null,
"defaultValue": null,
"locationType": "Region"
},
{
"name": "Zip",
"type": "esriFieldTypeString",
"alias": "Zip",
"sqlType": "sqlTypeNVarchar",
"length": 256,
"nullable": true,
"editable": true,
"domain": null,
"defaultValue": null,
"locationType": "Postal"
}
],
"indexes": [],
"types": [],
"templates": [
{
"name": "New Feature",
"description": "",
"drawingTool": "esriFeatureEditToolPoint",
"prototype": {
"attributes": {
"Name": null,
"Street": null,
"City": null,
"State": null,
"Zip": null
}
}
}
],
"supportedQueryFormats": "JSON, geoJSON",
"hasStaticData": false,
"maxRecordCount": -1,
"standardMaxRecordCount": 32000,
"tileMaxRecordCount": 8000,
"maxRecordCountFactor": 1,
"capabilities": "Querys"
},
"sourceCountryHint": "",
"hasStaticData": true,
"persistErrorRecordsForReview": true,
"candidateFieldsType": "Minimal",
"dateFieldsTimeReference": {
"timeZone": "Pacific Standard Time"
}
}
Excel publish parameters JSON properties
The publishParameters JSON object used to publish an Excel file is described below.
Parameter | Details |
---|---|
type | Indicates an Excel file. Example
|
name (Required) | Name of the service to be created. Example
|
description | A description for the published dataset. |
maxRecordCount | A double value indicating any constraints enforced on query operations. The default is -1 or int.MaxValue indicating no constraint. Example
|
sourceSR | Spatial reference of the input coordinates. The default is WKID 4326. Example
|
targetSR | Target spatial reference of the coordinates as stored in the database. The default is WKID 102100. Example
|
editorTrackingInfo | A JSON object that specifies editor tracking information. Example
|
hasAttachments | Indicates if the service has attachments. Values: true | false |
layerInfo | A JSON object specifies service capabilities. Example
|
layers (Required) | An array of JSON objects that provides additional information about each sheet of the Excel file. |
Excel publish parameters example
A sample publishParameters JSON object for an Excel file is as follows:
{
"type": "excel",
"name": "Offices",
"sourceUrl": "",
"maxRecordCount": 2000,
"sourceSR": {
"wkid": 4326,
"latestWkid": 4326
},
"targetSR": {
"wkid": 102100,
"latestWkid": 3857
},
"editorTrackingInfo": {
"enableEditorTracking": false,
"enableOwnershipAccessControl": false,
"allowOthersToQuery": true,
"allowOthersToUpdate": true,
"allowOthersToDelete": false,
"allowAnonymousToUpdate": true,
"allowAnonymousToDelete": true
},
"hasAttachments": false,
"capabilities": "Create,Delete,Query,Update,Editing",
"layers": [
{
"currentVersion": 10.8,
"id": 0,
"name": "Offices",
"type": "Table",
"displayField": "",
"description": "",
"copyrightText": "",
"locationType": "address",
"geocodeServiceUrl": "https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer",
"sourceLocale": "en",
"sourceCountry": "us",
"addressFields": {
"Address": "Street",
"City": "City",
"Region": "State",
"Postal": "Zip"
},
"standardizedFieldNames": {
"Address": "Street",
"City": "City",
"Region": "State",
"Postal": "ZIP",
"PostalExt": "ZIP4",
"CountryCode": "Country"
},
"excelSheetId": 0,
"defaultVisibility": true,
"relationships": [],
"isDataVersioned": false,
"supportsCalculate": true,
"supportsTruncate": false,
"supportsAttachmentsByUploadId": true,
"supportsRollbackOnFailureParameter": true,
"supportsStatistics": true,
"supportsAdvancedQueries": true,
"supportsValidateSql": true,
"supportsCoordinatesQuantization": true,
"supportsApplyEditsWithGlobalIds": false,
"advancedQueryCapabilities": {
"supportsPagination": true,
"supportsPaginationOnAggregatedQueries": true,
"supportsQueryRelatedPagination": true,
"supportsQueryWithDistance": true,
"supportsReturningQueryExtent": true,
"supportsStatistics": true,
"supportsOrderBy": true,
"supportsDistinct": true,
"supportsQueryWithResultType": true,
"supportsSqlExpression": true,
"supportsAdvancedQueryRelated": true,
"supportsReturningGeometryCentroid": false,
"supportsQueryWithDatumTransformation": true
},
"useStandardizedQueries": false,
"allowGeometryUpdates": true,
"hasAttachments": false,
"htmlPopupType": "",
"hasM": false,
"hasZ": false,
"globalIdField": "",
"typeIdField": "",
"fields": [
{
"name": "Name",
"type": "esriFieldTypeString",
"alias": "Name",
"sqlType": "sqlTypeOther",
"length": 256,
"nullable": true,
"editable": true,
"domain": null,
"defaultValue": null,
"locationType": "unknown"
},
{
"name": "Street",
"type": "esriFieldTypeString",
"alias": "Street",
"sqlType": "sqlTypeOther",
"length": 256,
"nullable": true,
"editable": true,
"domain": null,
"defaultValue": null,
"locationType": "Address"
},
{
"name": "City",
"type": "esriFieldTypeString",
"alias": "City",
"sqlType": "sqlTypeOther",
"length": 256,
"nullable": true,
"editable": true,
"domain": null,
"defaultValue": null,
"locationType": "City"
},
{
"name": "State",
"type": "esriFieldTypeString",
"alias": "State",
"sqlType": "sqlTypeOther",
"length": 256,
"nullable": true,
"editable": true,
"domain": null,
"defaultValue": null,
"locationType": "Region"
},
{
"name": "Zip",
"type": "esriFieldTypeString",
"alias": "Zip",
"sqlType": "sqlTypeOther",
"length": 256,
"nullable": true,
"editable": true,
"domain": null,
"defaultValue": null,
"locationType": "Postal"
}
],
"indexes": [],
"types": [],
"templates": [],
"supportedQueryFormats": "JSON, geoJSON",
"hasStaticData": false,
"maxRecordCount": -1,
"standardMaxRecordCount": 32000,
"tileMaxRecordCount": 8000,
"maxRecordCountFactor": 1,
"capabilities": "",
"dateFieldsTimeReference": {
"timeZone": "Pacific Standard Time"
}
}
],
"hasStaticData": true,
"layerInfo": {
"capabilities": "Query"
}
}
Shapefile, feature collections, and file geodatabases publish parameters JSON properties
The publishParameters JSON object used to publish shapefiles, feature collections, and file geodatabases is described below.
Parameter | Details |
---|---|
name | Name of the published service. The same name is reused as the name for the single layer within the service if the layerInfoparameter is not provided. Example
|
description | A user-friendly description for the published dataset. The same description is reused for the single layer within the service if the layerInfo parameter is not provided. Example
|
maxRecordCount | A double value indicating any constraints enforced on query operations. The default is -1 or int.MaxValue indicating no constraint. Example
|
copyrightText | Copyright information associated with the dataset. Example
|
layerInfo | A JSON object that provides additional information about the dataset. The JSON format resembles the layerDescriptor used in publishing feature services to an on-premises spatial data server or ArcGIS Server. Example
|
targetSR | Target spatial reference of the geometries as stored in the database. The default is WKID 102100. Example
|
Shapefile, feature collections, and file geodatabases publish parameters example
A sample publishParameters JSON object for publishing shapefiles, feature collections, and file geodatabases is as follows:
{
"name": "Name of published result",
"description": "test description",
"maxRecordCount": 500,
"copyrightText": "test copyright",
"targetSR": {"wkid": 4326},
"layerInfo": {
"name": "States From File",
"type": "Feature Layer",
"geometryType": "esri GeometryPolygon",
"minScale": 0,
"maxScale": 0,
"drawingInfo": {
"renderer": {
"type": "simple",
"symbol": {
"type": "esriSFS",
"style": "esriSFSSolid",
"color": [115,76,0,255],
"outline": {
"type": "esriSLS",
"style": "esriSLSSolid",
"color": [110,110,110,255],
"width": 1
}
}
},
"transparency": 0,
"labelingInfo": null
},
"htmlPopupType": "esriServerHTMLPopupTypeNone",
"fields": [],
"capabilities": "Query,Editing"
}
}
Response properties
Property | Details |
---|---|
type | The resulting item is a feature service, map service, or vector tile service URL item. |
serviceURL | The URL to the hosted feature, map service, or vector tile service. |
size | The approximate size required for the service. |
jobId | The job ID of the publishing process. All publishing operations are executed asynchronously. The caller is supposed to hold on to the job ID and check for job status. The status can be checked using Status passing in jobTypeas a query parameter, for example, jobType set as publish. |
serviceItemId | The ID of the new service item. |
preserveEditUsersAndTimestamps | The preserveEditUsersAndTimestamps parameter allows the user to preserve editor tracking info of the users and time stamps while publishing online. Nota:The default is not to preserve editor tracking info. Example
|
Response properties from publishing a tile service from an existing feature service
Property | Details |
---|---|
type | The resulting item is a map service URL item. |
serviceURL | The URL to the hosted feature or map service. |
jobId | The job ID of the publishing process. All publishing operations are executed asynchronously. The caller is supposed to hold on to the job ID and check for job status. The status can be checked using Status passing in jobTypeas a query parameter, for example, jobType set as publish. |
serviceItemId | The ID of the new service item. |
Additional example usage
Vector tile package
Below is a sample ArcGIS Enterprise POST request used to demonstrate how to publish a vector tile package:
POST /webadaptor/sharing/rest/content/users/jSmith/publish HTTP/1.1
Host: machine.domain.com
Content-Type: multipart/form-data; boundary=----boundary
Content-Length: []
------boundary
Content-Disposition: form-data; name="itemid"
345313e619df46f387f9ededbe15ac56
------boundary
Content-Disposition: form-data; name="file"; filename=""
Content-Type: application/octet-stream
------boundary
Content-Disposition: form-data; name="filetype"
vectorTilePackage
------boundary
Content-Disposition: form-data; name="publishParameters"
{"name":"SampleBasemap","maxRecordCount":2000}
------boundary
Content-Disposition: form-data; name="buildInitialCache"
true
------boundary
Content-Disposition: form-data; name="outputType"
VectorTiles
------boundary
Content-Disposition: form-data; name="f"
json
------boundary--
JSON Response syntax
{
"services": [
{
"type": "<type of service>",
"serviceurl": "<url to hosted service>",
"size": <size of service>,
"jobId": "<job id>",
"serviceItemId": "<new item id>"
}
]
}
JSON Response example
{
"services": [
{
"type": "Feature Service",
"serviceurl": "https://www.arcgis.com/fa019fbbfbb845d08cc9f0acde6dd8af/arcgis/rest/services/Streets_Service/FeatureServer",
"size": 2656729,
"jobId": "ff07c87a-dccd-46b4-9597-446dcda248ff",
"serviceItemId": "2e39b0b9550a40709f02a697cd9fc4fb"
}
]
}