ArcGIS Server 9.3 REST API First Looks, Part 1
Wed, May 14, 2008
4-minute read
Image via Wikipedia
You may (or may not) know that I am one of the authors of the ArcDeveloper REST API, which is an open source REST API for ArcGIS Server that can be used against ArcGIS Server (AGS) 9.2, right now, free to all comers, no waiting, etc. If you know that, you probably know that ESRI is releasing it's own REST API for AGS at 9.3, due out later this year. So, I thought I'd take a few posts to show you how the REST API (in beta) is looking. For the impatient, it looks great. For others that may not have the beta, read on.
So, first off, we are just gonna check out the very basics of the REST API. When you install 9.3, there is no real indication of anything all that different. The AGS Service Properties dialogs look (basically) the same, except for some (hugely exciting, but beyond the scope of this article) changes to the Caching tab. The real excitement comes when you start messing around with URLs against your map server. BTW, I am using Fiddler2 with the JSON Viewer plug-in to send requests to the server and look at the results.
AGS 9.0 and later have always exposed a SOAP endpoint for each service it publishes as well as service catalog. There is a whole SOAP API, which is my preferred method to interact with AGS services, and the URL to the SOAP service catalog looks like:
http://server/arcgis/services
Following this pattern, the REST API brings along a similar service catalog endpoint:
http://server/arcgis/rest/services
The new-kid-on-the-block REST URL is even cooler, though, as it formats the results into a cool "ArcGIS Service Explorer" that looks like:
Which allows you to look at metadata about your services, view them in Google Earth (how cool is that?), ArcMap, ArcGIS Explorer, or the new ArcGIS Javascript API (a subject of posts to come). Also, you can drill-down into your service and get layer info, spatial reference, unit info, and tiling information. In fact, on the tiling information, you can actually LOOK at some of the tiles. Other information includes supported operations that you can execute within the Explorer, like Export Map or Identify. Here's a picture of the service page:
Another item the Service page has is a "Supported Interfaces" section, which I would call supported formats. The ones listed out of the box are REST and SOAP. Clicking on the REST link will give you all (well, most of) the information just mentioned, but in JSON format . Here, lemme show you:
The only difference between the URL to get to the cool HTML Services Explorer page and the URL that spits out JSON is the addition of a 'f' (for 'format') querystring parameter, like so:
http://server/arcgis/rest/services/ServiceName/MapServer?f=json
MMMMM....now, THAT's some good REST.
There is similar love for supported operations, allowing you to crank out a quick image or perform a Find and look at the results. Also, the (impressively comprehensive) API reference is linked on the Services Explorer pages, which, oh by-the-way, takes you here.
Finally, the last thing I want to cover in this post is the REST admin inteface. If you go to the following URL in your browser:
http://server/arcgis/rest/admin
you'll be hit with a login screen for the ArcGIS REST API Admin application. It's pretty sparse right now, not even meriting a screen shot. Currently, you can use the admin site to tell AGS when to recycle the cached service responses and to turn on the REST Services Catalog. Now, that second option was nowhere to be found in my admin app, but the docs assure me it's there.
So far, the only disappointment I have had is that ESRI has chosen not to use GeoJSON as their format to return features in (or, for that matter, even as an option). I don't profess to know why, but I'll try to float that to one of my contacts on the mother ship soon.
Summing up, the AGS REST API looks great before you even show a map on a site. I am hoping to go that in future posts.