Skip To Content ArcGIS for Developers Sign In Dashboard

Publish Layers


The publishLayer operation publishes, or syncs, the datasets from a data store onto your ArcGIS Server, resulting in at least one layer per dataset.

When this operation is called for the first time, every parameter in the operation must be passed through. On subsequent calls, publishLayers will synchronize the datasets and created layers, which includes both publishing layers from new datasets and removing layers for datasets no longer found in the data store.


The portal folder must exist before the initial call. The server folder does not have to exist before the initial call. If the server folder does not already exist, it will be created during this operation. If the server folder does already exist, it must be empty before the operation is called.

After the initial call, the information used for the portalFolderId, serverId, and serverFolder parameters are remembered and the use of these parameters on subsequent calls is optional. While the information for the serverId and serverFolder cannot be changed, you will be able to change the portalFolderId information after the initial call. If you choose not to change the portal folder the layer items for new datasets will be placed within the original folder.


Only the owner of the data store item can invoke the publishLayers operation.

Request parameters


The itemId of the data store you wish to publish or sync the datasets from.



The JSON that will be used as a template for all the services that will be published or synced. This JSON can be used to change the properties of the data store's map and feature services. Only map service configurations with feature services enabled are supported by this parameter.

The following example has a feature server with a maxRecordCount of 3500:



The folder to which the datasets will be published. This parameter is not required after the initial call.



The serverId that the datasets will be published to. This parameter is not required after the initial call.



The name of the server folder. This parameter is not required after the initial call.



The response format. The default format is html.

Value: html | json

Example usage

Below is a sample URL for the publishLayers operation.<portal Id>/datastores/allDatasets/publishLayers

Request example

POST <self-url>/datastores/allDatasets/publishLayers?datastoreId=55d87f404a7e420bb969ccb70254bfec&templateScvConfig={"serviceName":null,"type":"MapServer","capabilities":"Map","extensions":[{"typeName":"FeatureServer","capabilities":"Query","enabled":"true","properties":{"maxRecordCount":"3500"}}]}&portalFolderId=f26efae67a7644499d43a6251e7df613&serverId=9sQswqEpB31ymiCD&serverFolder:TestFolder


This operation is an asynchronous operation. If successful, publishLayers will return a jobType and a jobId:

  "success" : true,
  "datastoreId" : "42d41b6663c14e8699dc630ccaf87ca6",
  "serverId" : "nxlsPtE4opGe8KeN",
  "jobType" : "publishAllDatasets",
  "jobId" : "jdf92dcb90f39472495d92c84b9c0e240"

The status operation can be used to check on the current state of the operation by making a request of the following form:<datastoreId>/status

There are three possible values that can be returned through the status operation: partial, completed, or failed. If successful (completed), the operation will return the following message: