I'm thinking it should be possible to consume an ESRI Geoprocessing service from a python script without invoking ArcPy or needing an ESRI installation on the client machine. For example I create a geoprocessing service that takes a series of point location and returns a csv file with the values under them as a file. I would like to include this service call in a python client application that will be running on machines that don't have any ESRI installation. Couldn't you create the rest call to kick off the service and consume the result without arcpy?

Does anyone have an example of how you might do this?

Thanks, Colin


ArcGIS for Server will give you JSON over HTTP. Python has HTTP client stuff built in (urllib, etc) and better community packages (Requests, httplib2). And JSON and Python go together like chips and salsa.

  • I've done stuff with urllib and owslib in Python so I can see how that might go together. I'll look into how to deserialize the JSON response. I quess I was most befuddled by how to structure the rest response with things like model parameters, specifying inputs from the client file system, etc. – Colin Talbert Jul 12 '12 at 18:21
  • To send a post request to an ESRI geocoder service, I am using the Python Requests module like this: r = requests.post(geocoderUri, params={"addresses":payload, "f":"json", "outSR":4326}) The payload var contains the json object that encodes the address data in the format that the service is expecting. – DavidF Jul 11 '14 at 21:08

For structuring the rest response, it may help to look at how the javascript API interacts with geoprocessing services using Firebug in Firefox. Typically all the parameters are either bare or in some JSON object and are appended to the url's query string (or sent via POST request) in an UrlEncoded format. Then you just need to parse the returned JSON results which you acquire by the f=json flag in the request.


Esri have published what they call the GeoServices REST Specification which can be accessed from here.

It contains a lot of the detail about the REST communication and is the foundation on which ArcGIS Server is based. This gives a lot of detail about the request and response structures for each of the service types. Section 6.0 (page 52) is the section dealing with the GP Service, perhaps this will help shed some light on how you should structure your requests.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.