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 createReplica 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 feature server. The replica name is unique per feature service.
This is a required parameter.

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

{"URL":"<url>"}

When transportType=esriTransportTypeUrl, the file returned in URL contains a JSON payload with a syntax as shown below. If transportType=esriTransportTypeEmbedded, a JSON object response as shown below is directly returned.

{
    "replicaName": "<replicaName>",
    "replicaID": "<replicaId>",
    "replicaServerGen": <replicaServerGen>,
    "responseType": "esriReplicaResponseTypeData",
    "layers": [
        {
            "id": "<layerId1>",
            "features": [
                {
                    <feature11>
                },
                {
                    <feature12>
                }
            ]
        },

      {
            "id": "<layerId2>",
            "features": [
                {
                    <feature21>
                },
                {
                    <feature22>
                }
            ]
        }
    ]
}

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