Output formats
The REST API supports responses in several formats. You specify the response format using the query parameter f. A list of valid formats is included for each of the resources and operations where f is a parameter.
- f=html: Default format unless otherwise stated. The response is an HTML page. The set of these HTML pages for each resource in the system is called the Services Directory.
To view the Services Directory page for the root directory of ArcGIS Online, you would use the following URL:
http://server.arcgisonline.com/arcgis/rest/services? f=html
Since "html" is the default value, you are not required to include this parameter in the URL. This means that the above URL is equivalent to the following URL:
- f=json: The response is a JSON object. This format is used primarily by the JavaScript APIs.
To retrieve the information in a JSON object, you would use the following URL:
http://server.arcgisonline.com/arcgis/rest/services? f=json
You can also reference a callback function in the URL as follows:
http://server.arcgisonline.com/arcgis/rest/services?f=json&callback=myMethod
If you want the JSON object to be more readable, you can use pjson. You should not include this parameter in your production applications, as it will affect performance. Use the parameter for debugging purposes only.
http://server.arcgisonline.com/arcgis/rest/services? f=pjson
- f=amf: The response is in Action Message Format (AMF), which is a binary format used to serialize ActionScript objects. This format is primarily for Adobe Flex/Adobe AIR clients, as it is much more efficient than JSON for large responses. AMF is supported in Query/Query related operations for both Map and Feature services. It is also supported in Synchronous GP, and for fetching the results of an Async GP operation.
- f=image: The response is a streamed image. No other information is included in the response.
- f=help: The response is a context sensitive help document. The following URL opens the help on the page that provides information about the map service resource:
http://services.arcgisonline.com/ArcGIS/rest/services/World_Physical_Map/MapServer? f=help
- f=lyr: Generates a layer file for viewing in ArcMap:
http://services.arcgisonline.com/ArcGIS/rest/services/World_Physical_Map/MapServer? f=lyr
- f=nmf: Generates a layer file for viewing in ArcGIS Explorer:
http://services.arcgisonline.com/ArcGIS/rest/services/World_Physical_Map/MapServer? f=nmf
- f=jsapi: The response is a web page for viewing a map service in a web browser using the ArcGIS JavaScript API:
http://services.arcgisonline.com/ArcGIS/rest/services/World_Physical_Map/MapServer? f=jsapi
- f=kmz: The response is a KML document wrapped in a KMZ file. It can be a footprint or the result of an operation.
In the following example, a request is made for a KML footprint of a map service with an extent of the United States:
For more information about KML as an output option, see KML support.
- f=ve: Deprecated and not supported at 10.1 and later.
- f=gmaps: Deprecated and not supported at 10.1 and later.