Overview
This topic discusses the JSON representation of layer source objects.
The following objects are discussed:
- Dynamic map layer
- Dynamic data layer
- Dynamic workspace layer
Dynamic map layer
A dynamic map layer refers to a layer in the current map service. If supported, use gdb to specify an alternate geodatabase version.
{
  "type": "mapLayer", //required
  "mapLayerId": <layerId>, //required
  "gdbVersion": "<version name>"
}{
  "type": "mapLayer",
  "mapLayerId": 3,
  "gdbVersion": "SDE.dynamicLayers"
}Dynamic data layer
A dynamic data layer is an on-the-fly layer created off of data from a registered workspace. The following data sources are supported:
- Source data from a table data source
- Source data from a query table data source
- Source data from a raster data source
- Source data from a join table data source
{
  "type": "dataLayer", //required
  "dataSource": <dataSource>, //required
  "fields": [
    {"name":"<fieldName1>","alias":"<fieldAlias1>"},
    {"name":"<fieldName2>","alias":"<fieldAlias2>"}
  ]
}{
  "type": "dataLayer",
  "dataSource": {
    "type": "table",
    "workspaceId": "MAP",
    "dataSourceName": "SDE.Counties",
    "gdbVersion": "SDE.dynamicLayers"
  },
  "fields": [
    {"name":"name","alias":"County Name"},
    {"name":"fips","alias":"County FIPS"}
  ]
}Dynamic workspace layer
A dynamic workspace layer refers to a pre-authored Layer File (.lyrx) created from ArcGIS Pro. These files reside in a registered folder. It allows you to dynamically use a pre-authored layer, with an advanced renderer and cartographically enriched symbols that are not supported by map service's REST API specifications, to a map service operation on a per request basis. There must be only one layer in a Layer File. For example, you cannot have a group layer or any other composite layer. The source of the layer inside a Layer File cannot be a map service, feature service, or WMS service.
{
  "type": "workspaceLayer", //required
  "workspaceId": <registered workspace id>>, //required
  "layerId": "<lyrx file name with extension>" //required
}{
  "type": "workspaceLayer",
  "workspaceId": "lyrx_folder",
  "layerId": "WorldCities.lyrx"
}