Common Search Parameters
Over the multiple search functions, there are various parameters which are common for all of them.
Contents
Query Parameters
Certain parameters must be put into the query string of the request. Below is a table describing those parameters.
| Name | Description |
|---|---|
|
key
String |
A unique key to authorize use of the Search Service. If you do not know your key or do not have an account with us, visit the Mapquest Developer Network.
This is a required parameter! |
| inFormat |
Specifies the format of the request. If this parameter is not supplied, the input format is assumed to be JSON-formatted text. The JSON-formatted input text must be supplied as either the
"json"
parameter of an HTTP GET, or as the BODY of an HTTP POST.
If this parameter is
"xml"
, the XML-formatted input text must be supplied as either the
"xml"
parameter of an HTTP GET, or as the BODY of an HTTP POST.
Must be one of the following, if supplied:
"json"
if not supplied
|
| json |
This parameter, if present, should contain the JSON-formatted text
of the request.
Use this parameter if you want to submit your request in JSON
format, but do not want to use an HTTP POST to submit body text.
Note: Remember to URL-escape the text in this parameter! |
| xml |
This parameter, if present, should contain the XML-formatted text
of the request.
Use this parameter if you want to submit your request in XML
format, but do not want to use an HTTP POST to submit body text.
Note: Remember to URL-escape the text in this parameter! |
| outFormat |
Specifies the format of the response.
Must be one of the following, if supplied:
"json"
if not supplied
|
|
ambiguities
String |
Use this parameter to set the strategy for resolving
ambiguous location names.
If this parameter is set to
"ignore"
, the Search Service
will simply use the first location found for an address.
If this parameter is not set, or set to a value other than
"ignore"
, the Search Service will return a full list of
the possible location matches in the
collections
attribute of the response.
|
| mapDataList List of MapData Objects |
MapData objects are map based data layers that can be searched. This is the data used to draw the map. With it you can search specific display types for specific information. Refer to the Map Data page for more information. Currently Map Data can't be searched with a Corridor Search (It's coming soon!).
|
| hostedDataList List of HostedData Objects |
HostedData objects will contain data hosted by Mapquest. This includes tables of points of interest from around the world, as well as allowing users to upload data to our servers for it to be stored. This parameter allows you to query these data sets as part of your search request. Refer to the Hosted Data page for more information.
|
| remoteDataList List of RemoteData Objects |
RemoteData objects contain data provided by the user as part of the request that will be included in the search. Refer to the Remote Data page for more information.
|
Options Parameters
There are also parameters which need to be placed inside an "options" object if using JSON or XML. If using key/value pairs, then use each parameter would just be another query parameter.
| Name | Description |
|---|---|
| units String |
Specifies the type of units to use when calculating distance. Search results are then ordered by distance from lowest to highest. Notice there are some additional parameters here than in our other services.
Acceptable values are:
"m"
|
| maxMatches Integer |
Maximum amount of results to return. |
| shapeFormat String |
These shapeFormats are also described in more detail on the Geometry page.
Shape format options:
See the Compressed Lat/Lng description page for more detail, including sample source code and an interactive encoder/decoder. See the Simple Features Wiki description page for more detail. |
| currentPage Integer |
Set this to return a specific page of the results. Refer to the Paging Documentation for more details and samples on paging results.
Defaults to 1 |
| pageSize Integer |
Set value to limit the search results returned. Refer to the Paging Documentation for more details and samples on paging results.
Defaults to returning all results found. |
| pageKey String |
This is the pageKey sent back with a previous request, it is used to retrieve the previous request's different pages of results. |
| kmlStyleUrl String |
This is a URL to a .kml file that gives style attributes to different mapData results. There is a default file will be used anytime the output is KML, unless the kmlStyleUrl parameter is present. The file can be viewed here.
|
Common Response Parameters
Over the multiple search functions, there are various parameters in the response which are common for all types of searches.
| Name | Description | JSON Example Return Value(s) | XML Example Return Value(s) |
|---|---|---|---|
| info |
This field contains information about the response. The statuscode subfield is an integer return value. Refer to the status codes page for more details on our status codes and error messages. The messages subfield is an array of error messages which describe the status |
|
|
| ambiguities Boolean |
This will return true or false if ambiguities could be returned. |
ambiguities: true
|
<ambiguities>true</ambiguities>
|
| units String |
Specifies the type of units to use when calculating distance.
Acceptable values are:
"m"
|
units: m
|
<units>m</units>
|
| maxMatches Integer |
Maximum amount of results to return. |
maxMatches: 5000
|
<maxMatches>5000</maxMatches>
|
| shapeFormat String |
Shape format of all shapePoints returned
See the Compressed Lat/Lng description page for more detail, including sample source code and an interactive encoder/decoder. See the Simple Features Wiki description page for more detail. |
shapeFormat: "raw"
|
<shapeFormat>raw</shapeFormat>
|
| currentPage Integer |
The current page of the results. |
currentPage: 1
|
<currentPage>1</currentPage>
|
| pageSize Integer |
If a page size was set on the request, this is the number of results to return in the request. |
pageSize: 10
|
<pageSize>10</pageSize>
|
| pageKey String |
If a pageSize is set, then the key to retrieve other pages will be returned. Refer to the Paging documentation for more details. |
pageKey: "0ba1e4a3-8fdc-4e68-9349-33086b83b2ef"
|
<pageKey>0ba1e4a3-8fdc-4e68-9349-33086b83b2ef</pageKey>
|
| mapData MapData |
A map data layer to search against |
|
<mapData> <name>navt</name> <dts> <dt>753</dt> <dt>800</dt> </dts> </mapData> |
| remoteData RemoteData |
A list of remote data to search against |
|
|
| hostedData HostedData |
A list of hosted data sources to search against |
|
|
| resultsCount Integer |
The number of total results found, this includes the cached paged items. |
resultsCount: 8
|
<resultsCount>8</resultsCount>
|
| searchResult SearchResult |
The results of the search request. Refer below to the SearchResult object documentation for details. |
|
|
Search Result
The following table describes the parameters returned in a Search Result Object
| Name | Description |
|---|---|
| key String |
the unique identifier for the search result in it's source. |
| name String |
the name of the result. |
| resultNumber Integer |
the number of the result through all search results, even paged data. |
| distance Double |
the distance from the center of the search area.
|
| distanceUnit String |
Specifies the type of units for the distance.
Values are:
|
| sourceName String |
The name of the source
|
| shapePoints Geometry |
The shape of the remote data object |
| fields Field[] |
This is a list of key/value pairs from the hosted data source. |
Search Result Example
| Type | Example |
|---|---|
| JSON |
|
| XML |
|