/publish: Publish Item

URL:
https://[root]/content/users/[userName]/publish
Methods:
GET

Example usage

The following is a sample ArcGIS Online request URL used to publish a shapefile:

Use dark colors for code blocksCopy
1
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:

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
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

ParameterDetails

itemID

The ID of the item to be published.

Example:

Use dark colors for code blocksCopy
1
itemId=345313e619df46f387f9ededbe15ac56

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.

Syntax:

Use dark colors for code blocksCopy
1
text=<text_in_file>

fileType

Item type.

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.

Example:

Use dark colors for code blocksCopy
1
publishParameters={"name":"Streets"}

outputType

If the user do not provide an outputType, the default is a feature service.

Example:

Use dark colors for code blocksCopy
1
outputType=Tiles

Values: Tiles | 3DTilesService | 3DTilesPackage

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 ArcGIS Enteprise 10.8.1. The item ID of the item. The item ID must not exist and must be 32 alphanumeric values.

Example:

Use dark colors for code blocksCopy
1
itemIdToCreate=832157e321df46f721f9ededbe34ac58

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.

ParameterDetails

type

Indicates a CSV file.

Example:

Use dark colors for code blocksCopy
1
"type": "csv"

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 layerInfo parameter is not provided.

Example:

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

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.

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 Excel field values.

Example:

Use dark colors for code blocksCopy
1
"addressTemplate": "{Address} {City}, {State} {Zip}"

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:

Use dark colors for code blocksCopy
1
"geocodeServiceUrl": "https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer",

sourceCountry

The two-character country code associated with the geocoding service.

Example:

Use dark colors for code blocksCopy
1
"sourceCountry": "us"

sourceLocale

The locale used for the geocoding service source.

Example:

Use dark colors for code blocksCopy
1
"sourceLocale": "en"

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:

Use dark colors for code blocksCopy
1
2
3
4
5
6
{
  "Address": "Street",
  "City": "City",
  "Region": "State",
  "Postal": "Zip"
}

standardizedFieldNames

A JSON object indicates the standardized field names mapping in the geocode service given the country selected.

Example:

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
{
  "Address": "Street",
  "City": "City",
  "Region": "State",
  "Postal": "ZIP",
  "PostalExt": "ZIP4",
  "CountryCode": "Country"
}

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.

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
{
  "id": <id>,
  "name": "<layer name>",
  "type": "<type>",
  "displayField": "<displayField>",
  "description": "<description>",
  "copyrightText": "<copyright text>",
  "defaultVisibility": true,
  "minScale": <number>,
  "maxScale": <number>,
  "extent": {<extent JSON with spatial ref>},
  "drawingInfo": {<drawing info JSON>},
  "allowGeometryUpdates": true,
  "hasAttachments": false,
  "htmlPopupType": "<popup type>",
  "globalIdField": "<name of the global Id field>",
  "objectIdField": "<name of object Id field>",
  "typeIdField": "<type Id field>",
  "fields": [<array of field JSON objects>],
  "indexes": [<array of indexes>],
  "types": [<array of type JSON objects>],
  "templates": [<array of type JSON objects>],
  "supportedQueryFormats": "JSON, geoJSON",
  "hasStaticData": false,
  "maxRecordCount": <max num of records returned for a query>,
  "standardMaxRecordCount": <max num of records returned when resultType is standard>,
  "tileMaxRecordCount": <max num of records returned when resultType is tile>,
  "maxRecordCountFactor": <multiplier applies to all 3 types of max record count>,
  "capabilities": "<service layer capabilities>"
}

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:

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

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:

Use dark colors for code blocksCopy
1
"columnDelimiter": ","

sourceSR

Spatial reference of the input coordinates. The default is WKID 4326.

Example:

Use dark colors for code blocksCopy
1
2
3
4
{
  "wkid": 4326,
  "latestWkid": 4326
}

targetSR

Target spatial reference of the coordinates as stored in the database. The default is WKID 102100.

Example:

Use dark colors for code blocksCopy
1
2
3
4
{
  "wkid": 102100,
  "latestWkid": 3857
}

editorTrackingInfo

A JSON object that specifies editor tracking information.

Example:

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
{
  "enableEditorTracking": false,
  "enableOwnershipAccessControl": false,
  "allowOthersToQuery": true,
  "allowOthersToUpdate": true,
  "allowOthersToDelete": false,
  "allowAnonymousToUpdate": true,
  "allowAnonymousToDelete": true
}

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:

Use dark colors for code blocksCopy
1
2
3
{
  "timeZone": "Pacific Standard Time"
}

CSV publish parameters example

A sample publishParameters JSON object for a CSV file is as follows:

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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
{
  "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.

ParameterDetails

type

Indicates an Excel file.

Example:

Use dark colors for code blocksCopy
1
"type": "excel"

name

(Required)

Name of the service to be created.

Example:

Use dark colors for code blocksCopy
1
"name": "Offices",

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:

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

sourceSR

Spatial reference of the input coordinates. The default is WKID 4326.

Example:

Use dark colors for code blocksCopy
1
2
3
4
{
  "wkid": 4326,
  "latestWkid": 4326
}

targetSR

Target spatial reference of the coordinates as stored in the database. The default is WKID 102100.

Example:

Use dark colors for code blocksCopy
1
2
3
4
{
  "wkid": 102100,
  "latestWkid": 3857
}

editorTrackingInfo

A JSON object that specifies editor tracking information.

Example:

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
{
  "enableEditorTracking": false,
  "enableOwnershipAccessControl": false,
  "allowOthersToQuery": true,
  "allowOthersToUpdate": true,
  "allowOthersToDelete": false,
  "allowAnonymousToUpdate": true,
  "allowAnonymousToDelete": true
}

hasAttachments

Indicates if the service has attachments.

Values: true | false

layerInfo

A JSON object specifies service capabilities.

Example:

Use dark colors for code blocksCopy
1
2
3
{
  "capabilities": "Query"
}

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:

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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
{
  "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.

ParameterDetails

name

Name of the published service. The same name is reused as the name for the single layer within the service if the layerInfo parameter is not provided.

Example:

Use dark colors for code blocksCopy
1
"name": "Name of published result"

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:

Use dark colors for code blocksCopy
1
"description": "test description"

maxRecordCount

A double value indicating any constraints enforced on query operations. The default is -1 or int.MaxValue indicating no constraint.

Example:

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

copyrightText

Copyright information associated with the dataset.

Example:

Use dark colors for code blocksCopy
1
"copyrightText": "test copyright"

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:

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
{
  "name": "<layer name>",
  "type": "Feature Layer",
  "description": "<description>",
  "copyrightText": "<copyright text>",
  "geometryType": "<geometry type>",
  "minScale": <number>,
  "maxScale": <number>,
  "extent": {<extent JSON with spatial ref>},
  "drawingInfo": {<drawing info JSON>},
  "hasAttachments": false,
  "htmlPopupType": "<popup type>",
  "objectIdField": "<object Id field>",
  "globalIdField": "",
  "typeIdField": "<type Id field>",
  "fields": [<array of field JSON objects>],
  "types": [<array of type JSON objects>],
  "templates": [<array of type JSON objects>],
  "capabilities": "<Query and/or Editing, comma separated>"
}

targetSR

Target spatial reference of the geometries as stored in the database. The default is WKID 102100.

Example:

Use dark colors for code blocksCopy
1
"targetSR": {"wkid": 4326}

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:

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
{
  "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

PropertyDetails

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 jobType as 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.

Example:

Use dark colors for code blocksCopy
1
2
3
4
5
6
{
  "editorTrackingInfo": {
    "enableEditorTracking": true
    "preserveEditUsersAndTimeStamps": true
  }
}

Response properties from publishing a tile service from an existing feature service

PropertyDetails

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 jobType as 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:

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
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

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
{
  "services": [
    {
      "type": "<type of service>",
      "serviceurl": "<url to hosted service>",
      "size": <size of service>,
      "jobId": "<job id>",
      "serviceItemId": "<new item id>"
    }
  ]
}

JSON Response example

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
{
  "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"
    }
  ]
}

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