FRAMES | NO FRAMES Description | Parameters | Examples | Response
Create Replica - Feature Service (Operation)
URL http://<featureservice-url>/createReplica(POST only)
Parent Resource Feature Service
Required Capability Create,Update,Delete

Description

The create replica operation is performed on a feature service resource. This operation creates the replica between the feature service and a client based on a client supplied replica definition.

The response for this operation includes the replicaID, server generation number and data similar to the feature services query operationís response.

You can provide arguments to the Create Replica operation as query parameters defined in the parameters table below.

Parameters

Parameter Details
f Description: The response format. The default response format is html.

Values: html | json

replicaName Description: The name of the replica on the server. The replica name is unique per feature service.
This is not a required parameter. If not specified, a replica name will be assigned, and returned in the Create Replica response.

Syntax: replicaName=<replicaName>

Example: replicaName=myReplica
layers Required
Description: The list of layers and tables to include in the replica.

Syntax: layers=[<layer1>, <layer2>, <table1>]

Example: layers=0, 1, 2


NOTE: The array based syntax (e.g [0,1,2]) that was supported in 10.1 has been deprecated starting with 10.1 sp1.
layerQueries Description: In addition to the layers and geometry parameters, the layerQueries parameter can be used to further define what is replicated. This parameter allows you to set properties on a per layer or per table basis. Only the properties for the layers and tables that you want change from the default are required. The properties include:
  • where: Defines an attribute query for a layer or table. The default is no where clause.
  • useGeometry: Determines whether or not to apply the geometry for the layer. The default is true. If set to false, features from the layer that intersect the geometry are not added.
  • includeRelated: Determines whether or not to add related rows. The default is true.

Syntax: layerQueries={ Layer_or_tableID1 : {"where":"attribute query" , "useGeometry" : true | false, "includeRelated" : true | false}, Layer_or_tableID2: {.}}

Examples:
  • layerQueries={"1":{"useGeometry " : false}}
  • layerQueries={"0":{"where" : "requires_inspection = True" }, "1":{"useGeometry " : false}}
  • layerQueries={"0":{"useGeometry " : false, "includeRelated" : false}}, "1":{"useGeometry " : false}}
geometry Required
Description: The geometry to apply as the spatial filter. The structure of the geometry is the same as the structure of the json geometry objects returned by the ArcGIS REST API. In addition to the JSON structures, for envelopes and points, you can specify the geometry with a simpler comma-separated syntax.

Syntax:
  • JSON structures: geometryType=<geometryType>&geometry={geometry}
  • Envelope simple syntax: geometryType=esriGeometryEnvelope&geometry=<xmin>,<ymin>,<xmax>,<ymax>
  • Point simple syntax: geometryType=esriGeometryPoint&geometry=<x>,<y>
Examples:
  • geometryType=esriGeometryEnvelope&geometry={xmin: -104, ymin: 35.6, xmax: -94.32, ymax: 41}
  • geometryType=esriGeometryEnvelope&geometry=-104,35.6,-94.32,41
  • geometryType=esriGeometryPoint&geometry=-104,35.6
geometryType Description: The type of geometry specified by the geometry parameter. The geometry type can be an envelope, point, line, or polygon. The default geometry type is an envelope.

Values: esriGeometryPoint | esriGeometryMultipoint | esriGeometryPolyline | esriGeometryPolygon | esriGeometryEnvelope
inSR Description: The spatial reference of the input geometry.

The spatial reference can be specified as either a well-known ID or as a spatial reference json object.

If the inSR is not specified, the geometry is assumed to be in the spatial reference of the map.
transportType Description: The tranportType represents the response format. If the transportType is esriTransportTypeUrl, the JSON response is contained in a file and the URL link to the file is returned. Otherwise the JSON object is returned directly.

Values: esriTransportTypeUrl | esriTransportTypeEmbedded

returnAttachments Description: If true, attachments are added to the replica and returned in the response. Otherwise attachments are not included. The default is false.

Values: true | false
returnAttachmentDatabyURL Description: If true, a reference to a URL will be provided for each attachment returned from createReplica. Otherwise attachments are embedded in the response. The default is true.

Note, applies only if returnAttachments is true.

Values: true | false

Example Usage

Example 1: Create Replica:


JSON Response Syntax: esriTransportTypeEmbedded

If transportType=esriTransportTypeEmbedded, a JSON object response as shown below is directly returned.

{
    "transportType": "esriTransportTypeEmbedded",
    "replicaName": "<replicaName>",
    "replicaID": "<replicaId>",
    "replicaServerGen": <replicaServerGen>,
    "responseType": "esriReplicaResponseTypeData",
    "layers": [
        {
          "id": "<layerId1>",
          "features": [ <feature1>, <feature2> ]
          "attachments": [ <attachment1>, <attachment2> ]
        },
        {
          "id": "<layerId2>",
          "features": [ <feature1>, <feature2> ]
          "attachments": [ <attachment1>, <attachment2> ]
        }
    ]
}

JSON Response Syntax: esriTransportTypeUrl

When transportType=esriTransportTypeUrl, the file returned in the URL contains a JSON payload with a syntax as shown below.

{
    "transportType": "esriTransportTypeURL",
    "URL":"<url>"
}

JSON payload in the file:

{
    "replicaName": "<replicaName>",
    "replicaID": "<replicaId>",
    "replicaServerGen": <replicaServerGen>,
    "responseType": "esriReplicaResponseTypeData",
    "layers": [
        {
          "id": "<layerId1>",
          "features": [ <feature1>, <feature2> ]
          "attachments": [ <attachment1>, <attachment2> ]
        },
        {
          "id": "<layerId2>",
          "features": [ <feature1>, <feature2> ]
          "attachments": [ <attachment1>, <attachment2> ]
        }
    ]
}

JSON Response Example

{"URL": "http://machinename:6080/arcgis/rest/directories/arcgisoutput/Hurricanes_msd_MapServer/test113c26d11b80f049c09aef1e6c1327641c.json"}

File content:

{
    "replicaName": "replicaHurricaneAlberto",
    "replicaID": "3E0FB2FF-296B-4058-A1DF-234EEBBE5BED",
    "replicaServerGen": 0,
    "responseType": "esriReplicaResponseTypeData",
    "layers": [
        {
            "id": "0",
            "features": [
                {
                    "geometry": {
                        "x": -25.199999999900058,
                        "y": 12.699999999900058
                    },
                    "attributes": {
                        "OBJECTID": 5,
                        "DAY": 965347200000,
                        "TIME": "18:00:00",
                        "LAT": 12.7,
                        "LONG": -25.2,
                        "PRESSURE": 1002,
                        "WINDSPEED": 40,
                        "STAGE": "tropical storm",
                        "EVENTID": "Alberto",
                        "Date_Time": 965412000000,
                        "Date_Time_PST": 965383200000
                    }
                },
                {
                    "geometry": {
                        "x": -26.699999999600323,
                        "y": 13.199999999800127
                    },
                    "attributes": {
                        "OBJECTID": 6,
                        "DAY": 965433600000,
                        "TIME": "00:00:00",
                        "LAT": 13.2,
                        "LONG": -26.7,
                        "PRESSURE": 1001,
                        "WINDSPEED": 40,
                        "STAGE": "tropical storm",
                        "EVENTID": "Alberto",
                        "Date_Time": 965433600000,
                        "Date_Time_PST": 965404800000
                    }
                }
            ]
        }
    ]
}

JSON Response Example - Data contains attachments

{"URL": "http://machinename:6080/arcgis/rest/directories/arcgisoutput/Canada/test113c26d11b80f049c09aef1e6c1327641c.json"}

File content:

{
 "replicaName": "ags_gfs_4",
 "replicaID": "D4B2D34C-61DD-4AED-BF37-B7AC363CDB08",
 "replicaServerGen": 0,
 "responseType": "esriReplicaResponseTypeData",
 "layers": [
  {
   "id": 0,
   "features": [
    {
     "geometry": {
      "x": -123.06999969499992,
      "y": 49.159999847000051
     },
     "attributes": {
      "OBJECTID": 1,
      "NAME": "Vancouver",
      "CAPITAL": "N",
      "PROV_NAME": "British Columbia",
      "GLOBALID": "{C74D42DB-5D07-4AB8-8C91-11AE1E52E6A3}",
      "POPULATION_DOMAIN": 4,
      "RepRowID": 1
     }
    },
    {
     "geometry": {
      "x": -114.05000305199991,
      "y": 51.029998779000039
     },
     "attributes": {
      "OBJECTID": 2,
      "NAME": "Calgary",
      "CAPITAL": "N",
      "PROV_NAME": "Alberta",
      "GLOBALID": "{6A33F63A-AA90-4970-AB76-76B32E702745}",
      "POPULATION_DOMAIN": 5,
      "RepRowID": 2
     }
    },
    {
     "geometry": {
      "x": -113.27999877899992,
      "y": 53.330001831000061
     },
     "attributes": {
      "OBJECTID": 3,
      "NAME": "Edmonton",
      "CAPITAL": "Y",
      "PROV_NAME": "Alberta",
      "GLOBALID": "{4D809477-4994-4B8C-80E7-1631E0AD3FA9}",
      "POPULATION_DOMAIN": 4,
      "RepRowID": 3
     }
    },
    {
     "geometry": {
      "x": -97.124443053999926,
      "y": 49.921169281000061
     },
     "attributes": {
      "OBJECTID": 4,
      "NAME": "Winnipeg",
      "CAPITAL": "Y",
      "PROV_NAME": "Manitoba",
      "GLOBALID": "{CDB3FD57-2E2A-4FBF-998D-B84E5E26167D}",
      "POPULATION_DOMAIN": 3,
      "RepRowID": 4
     }
    },
    {
     "geometry": {
      "x": -75.650749206999933,
      "y": 45.374221802000079
     },
     "attributes": {
      "OBJECTID": 6,
      "NAME": "Ottawa",
      "CAPITAL": "C",
      "PROV_NAME": "Ontario",
      "GLOBALID": "{0F2F8880-4763-481A-9379-62B573ED3154}",
      "POPULATION_DOMAIN": 4,
      "RepRowID": 6
     }
    },
    {
     "geometry": {
      "x": -73.653526305999947,
      "y": 45.541019440000071
     },
     "attributes": {
      "OBJECTID": 7,
      "NAME": "Montreal",
      "CAPITAL": "N",
      "PROV_NAME": "Quebec",
      "GLOBALID": "{BE529DB3-D879-476F-B3CA-FF4E9B32A36B}",
      "POPULATION_DOMAIN": 6,
      "RepRowID": 7
     }
    },
    {
     "geometry": {
      "x": -71.244926452999948,
      "y": 46.802070618000073
     },
     "attributes": {
      "OBJECTID": 8,
      "NAME": "Quebec",
      "CAPITAL": "Y",
      "PROV_NAME": "Quebec",
      "GLOBALID": "{99FD4EF2-4548-4FD6-97A4-CAC6B3185373}",
      "POPULATION_DOMAIN": 3,
      "RepRowID": 8
     }
    },
    {
     "geometry": {
      "x": -123.34989929199992,
      "y": 48.451988220000032
     },
     "attributes": {
      "OBJECTID": 9,
      "NAME": "Victoria",
      "CAPITAL": "Y",
      "PROV_NAME": "British Columbia",
      "GLOBALID": "{8F558B76-98E1-41AE-92D0-148547E344A6}",
      "POPULATION_DOMAIN": 2,
      "RepRowID": 9
     }
    }
   ],
   "attachments": [
    {
     "attachmentId": 2,
     "globalId": "{A8AFEC66-516B-40E9-9BAC-2F26AB0E0253}",
     "parentGlobalId": "{C74D42DB-5D07-4AB8-8C91-11AE1E52E6A3}",
     "contentType": "application/pdf",
     "size": 762519,
     "name": "celebrate_CND.pdf",
     "url": "http://myserver:6080/arcgis/rest/directories/arcgisoutput/Canada/_ags_fsRep_attach1c2b660372a64876944b1e874c930b3f.pdf"
    },
    {
     "attachmentId": 3,
     "globalId": "{B5B41B49-73C4-48C1-A5B0-4DFDDCA73F25}",
     "parentGlobalId": "{C74D42DB-5D07-4AB8-8C91-11AE1E52E6A3}",
     "contentType": "image/jpeg",
     "size": 35277,
     "name": "vancouver.jpg",
     "url": "http://myserver:6080/arcgis/rest/directories/arcgisoutput/Canada/_ags_fsRep_attach83633fbcc78e400cbe669f16700d467f.jpg"
    },
    {
     "attachmentId": 4,
     "globalId": "{4E430844-01C2-41F5-A540-B9BE97A0D187}",
     "parentGlobalId": "{8F558B76-98E1-41AE-92D0-148547E344A6}",
     "contentType": "image/jpeg",
     "size": 4424,
     "name": "rockies.jpg",
     "url": "http://myserver:6080/arcgis/rest/directories/arcgisoutput/Canada/_ags_fsRep_attach54cc055852e64c589b5cd60b51ee4645.jpg"
    },
    {
     "attachmentId": 5,
     "globalId": "{E71B2FC1-1173-424E-9B01-57B6FD2CBCD6}",
     "parentGlobalId": "{8F558B76-98E1-41AE-92D0-148547E344A6}",
     "contentType": "image/jpeg",
     "size": 18813,
     "name": "novascotia.jpg",
     "url": "http://myserver:6080/arcgis/rest/directories/arcgisoutput/Canada/_ags_fsRep_attach80bea2ecd080460cbe6155fa1ec79532.jpg"
    },
    {
     "attachmentId": 6,
     "globalId": "{CB299B1F-736D-4080-B01E-C07B1B6ABA88}",
     "parentGlobalId": "{6A33F63A-AA90-4970-AB76-76B32E702745}",
     "contentType": "image/jpeg",
     "size": 52568,
     "name": "mountains.jpg",
     "url": "http://myserver:6080/arcgis/rest/directories/arcgisoutput/Canada/_ags_fsRep_attach60fbca550b944f4b855f2fb1f0375955.jpg"
    },
    {
     "attachmentId": 7,
     "globalId": "{5B2D5F6C-8495-4BB4-9D09-B4DA9EE8D3B9}",
     "parentGlobalId": "{4D809477-4994-4B8C-80E7-1631E0AD3FA9}",
     "contentType": "application/pdf",
     "size": 84256,
     "name": "cnd_doc.pdf",
     "url": "http://myserver:6080/arcgis/rest/directories/arcgisoutput/Canada/_ags_fsRep_attach8bffd96db040439694bde39b23f8f392.pdf"
    },
    {
     "attachmentId": 24,
     "globalId": "{17686592-E726-40F0-8B73-2168C7543E43}",
     "parentGlobalId": "{BE529DB3-D879-476F-B3CA-FF4E9B32A36B}",
     "contentType": "image/jpeg",
     "size": 4424,
     "name": "rockies.jpg",
     "url": "http://myserver:6080/arcgis/rest/directories/arcgisoutput/Canada/_ags_fsRep_attach981c1c88d9194ac3b6382b67f410d629.jpg"
    },
    {
     "attachmentId": 25,
     "globalId": "{998ECBE2-6D27-4244-82A2-5E05D7A6655D}",
     "parentGlobalId": "{BE529DB3-D879-476F-B3CA-FF4E9B32A36B}",
     "contentType": "image/jpeg",
     "size": 118371,
     "name": "politics.jpg",
     "url": "http://myserver:6080/arcgis/rest/directories/arcgisoutput/Canada/_ags_fsRep_attach9093c7c9ea9748f0a5b41a2972a8db0e.jpg"
    },
    {
     "attachmentId": 29,
     "globalId": "{913DCE0B-0655-410C-8697-95EB872F2EA8}",
     "parentGlobalId": "{0F2F8880-4763-481A-9379-62B573ED3154}",
     "contentType": "image/jpeg",
     "size": 52568,
     "name": "mountains.jpg",
     "url": "http://myserver:6080/arcgis/rest/directories/arcgisoutput/Canada/_ags_fsRep_attach6c2bb62d0c1d43ff8810c2485ca5e21b.jpg"
    },
    {
     "attachmentId": 30,
     "globalId": "{E39194E1-A2B5-4920-9BB2-1189EA5E5FA4}",
     "parentGlobalId": "{0F2F8880-4763-481A-9379-62B573ED3154}",
     "contentType": "image/jpeg",
     "size": 19530,
     "name": "polarbear_cub.jpg",
     "url": "http://myserver:6080/arcgis/rest/directories/arcgisoutput/Canada/_ags_fsRep_attach55256b8ad9724574a17c47f960959cc1.jpg"
    },
    {
     "attachmentId": 31,
     "globalId": "{C7BF62B1-D8DB-4ECD-ACB7-42BEC64DB59B}",
     "parentGlobalId": "{0F2F8880-4763-481A-9379-62B573ED3154}",
     "contentType": "image/jpeg",
     "size": 118371,
     "name": "politics.jpg",
     "url": "http://myserver:6080/arcgis/rest/directories/arcgisoutput/Canada/_ags_fsRep_attach9dc1d884ed0e45e0b1ea1a2ef96f17e4.jpg"
    },
    {
     "attachmentId": 32,
     "globalId": "{CAD4BFAA-F6D6-43A5-8594-DCA86C468F88}",
     "parentGlobalId": "{99FD4EF2-4548-4FD6-97A4-CAC6B3185373}",
     "contentType": "image/jpeg",
     "size": 118371,
     "name": "politics.jpg",
     "url": "http://myserver:6080/arcgis/rest/directories/arcgisoutput/Canada/_ags_fsRep_attachd807f2238bf04074836a3e2648bb740d.jpg"
    },
    {
     "attachmentId": 33,
     "globalId": "{21A265D7-87BE-4C46-B59F-FBFF5FE8A533}",
     "parentGlobalId": "{99FD4EF2-4548-4FD6-97A4-CAC6B3185373}",
     "contentType": "image/jpeg",
     "size": 28588,
     "name": "flag.jpg",
     "url": "http://myserver:6080/arcgis/rest/directories/arcgisoutput/Canada/_ags_fsRep_attach27740a4f7c4d422a893a6c263bd79575.jpg"
    },
    {
     "attachmentId": 34,
     "globalId": "{FF4E9E9E-BC4C-48F5-B2DA-EA9D243EB6B3}",
     "parentGlobalId": "{99FD4EF2-4548-4FD6-97A4-CAC6B3185373}",
     "contentType": "image/jpeg",
     "size": 69583,
     "name": "highway.jpg",
     "url": "http://myserver:6080/arcgis/rest/directories/arcgisoutput/Canada/_ags_fsRep_attachc225fced338547cf81f0f6eb575e60e8.jpg"
    },
    {
     "attachmentId": 35,
     "globalId": "{1C6F43AD-68F7-4C27-A683-639D7B973909}",
     "parentGlobalId": "{99FD4EF2-4548-4FD6-97A4-CAC6B3185373}",
     "contentType": "image/jpeg",
     "size": 52568,
     "name": "mountains.jpg",
     "url": "http://myserver:6080/arcgis/rest/directories/arcgisoutput/Canada/_ags_fsRep_attach31d77279e58e4fec8cc3c6f30a714bb5.jpg"
    },
    {
     "attachmentId": 48,
     "globalId": "{90234EC7-0D60-4178-993A-0D132E63A9EF}",
     "parentGlobalId": "{CDB3FD57-2E2A-4FBF-998D-B84E5E26167D}",
     "contentType": "application/pdf",
     "size": 331959,
     "name": "CND_goose.pdf",
     "url": "http://myserver:6080/arcgis/rest/directories/arcgisoutput/Canada/_ags_fsRep_attach6b4143202a1445ac81f1218b9b28c503.pdf"
    }
   ]
  }
 ]
}