ArcDeveloper REST: U R I and I R U
Sat, Mar 8, 2008
3-minute read
http://<yourServer>/rest.svc/service/layer/3?format=geojsonIt's clear and easy and other URI endpoints are easy to deduce. Yup, we are RESTing we the best of them. Our main endpoint is the rest.svc, which is WCF's way of exposing a service endpoint. The first question, then, we had to answer was how we would handle the URI routing. If the map services are registered dynamically (using Castle Windsor, which is arguably the greatest piece of code ever written. Ever. Not that I am prone to hyperbole. Oh, I'll cover the configuration in the next post) then we have to dissect the various pieces of the URI to:
- Get a hold of the service requested.
- Query the right layer
- Use the right query parameters.
- Grab the right formatter.
[OperationContract]
[WebGet(UriTemplate="{serviceName}/{featureType}/{featureId}?g={geom}",ResponseFormat=WebMessageFormat.Json)]
Stream GetSingleFeatureJSON(string serviceName, string featureType, string featureId, bool geom);
http://yourserver/rest.svc/services
http://yourserver/rest.svc/serviceName/layerName/OBJECTID?g=true
http://yourserver/rest.svc/serviceName/layerName?query=whereClause&bbox=xmin,ymin,xmax,ymax&g=true