FRAMES | NO FRAMES Description | Parameters | Examples | Response
Find (Operation)
URL http://<mapservice-url>/find
Parent Resource Map Service

Description

The find operation is performed on a map service resource. The result of this operation is a find results resource. Each result includes its value, feature ID, field name, layer ID, layer name, geometry, geometry type, and attributes in the form of name-value pairs.

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

At 10, support for generalizing geometries returned by the find operation was added.

Parameters

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

Values: html | json
searchText Required
Description: The search string. This is the text that is searched across the layers and the fields that the user specifies.

Example: searchText=Los
contains Description: If false, the operation searches for an exact match of the searchText string. An exact match is case sensitive. Otherwise, it searches for a value that contains the searchText provided. This search is not case sensitive. The default is true.

Values: true | false
searchFields Description: The names of the fields to search. The fields are specified as a comma-separated list of field names. If this parameter is not specified, all fields are searched.

Syntax: searchFields=<fieldName1>,<fieldName2>
where fieldName1, fieldName2 are the field names returned by the layer resource

Example: searchFields=AREANAME,SUB_REGION
sr Description: The well-known ID of the spatial reference of the output geometries. If sr is not specified, the output geometries are returned in the spatial reference of the map.
layerDefs (New in 10)

Description: Allows you to filter the features of individual layers in the exported map by specifying definition expressions for those layers. Definition expression for a layer that is published with the service will be always honored.

Simple Syntax:

Syntax: layerId1:layerDef1;layerId2:layerDef2
where layerId1, layerId2 are the layer ids returned by the map service resource

Example: 0:POP2000 > 1000000;5:AREA > 100000

JSON Syntax:

You can also use a JSON representation for Layer Definitions.

Syntax:
{ "<layerId1>" : "<layerDef1>" , "<layerId2>" : "<layerDef2>" }
where layerId1, layerId2 are the layer ids returned by the map service resource

Example:
{"0":"POP2000 > 1000000","5":"AREA > 100000"}
layers Required
Description: The layers to perform the find operation on. The layers are specified as a comma-separated list of layer ids.

Syntax: layers=<layerId1>,<layerId2>
where layerId1, layerId2 are the layer ids returned by the map service resource

Example
layers=2,4,7
returnGeometry Description: If true, the resultset includes the geometries associated with each result. The default is true.

Values: true | false
maxAllowableOffset //This option was added at 10.0

Description: This option can be used to specify the maximum allowable offset to be used for generalizing geometries returned by the find operation.

Example: maxAllowableOffset=2

Example Usage

Example 1: Find operation that includes search text and a layer. The response is in HTML format:

http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Specialty/ESRI_StatesCitiesRivers_USA/MapServer/find?searchText=island&contains=true&searchFields=&sr=&layers=0,2&returnGeometry=true

JSON Response Syntax

{
"results" : [
{
"layerId" : <layerId1>,
"layerName" : "<layerName1>",
"displayFieldName" : "<displayFieldName1>"
"foundFieldName" : "<foundFieldName1>",
 "value" : "<value1>",
"attributes" : {
"<fieldName11>" : <fieldValue11>,
"<fieldName12>" : <fieldValue12>
},
"geometryType" : "<geometryType1>",
"geometry" : {
<geometry1>}
},
{
"layerId" : <layerId2>,
"layerName" : "<layerName2>",
"displayFieldName" : "<displayFieldName2>"
"foundFieldName" : "<foundFieldName2>",
 "value" : "<value2>",
 "attributes" : {
"<fieldName21>" : <fieldValue21>,
"<fieldName22>" : <fieldValue22>
},
"geometryType" : "<geometryType2>",
"geometry" : {<geometry2>}
}
]
}

JSON Response Example

{
"results" : [
{
"layerId" : 3,
"layerName" : "Cities",
"displayFieldName" : "City Name"
"foundFieldName" : "City Name",
 "value" : "Joe City",
"attributes" : {
"City Name" : "Joe City",
"CLASS" : "city",
"ST" : "CA"
},
"geometryType" : "esriGeometryPoint",
"geometry" : { "x" : -118.375, "y" : 34.086, "spatialReference" : {"wkid" : 4326} }
},
{
"layerId" : 59,
"layerName" : "Parcel",
"displayFieldName" : "NAME"
"foundFieldName" : "NAME",
"value" : "Joe's Parcel",
"attributes" : {
"NAME" : "Parcel 649",
"SUB_REGION" : "Pacific",
"STATE_ABBR" : "CA"
},
"geometryType" : "esriGeometryPolygon",
"geometry" : { "spatialReference" : {"wkid" : 4326}, "rings" : [[[-118.35,32.81],[-118.42.806],[-118.511,32.892],[-118.35,32.81]]]}
}
]
}