Quantcast
Channel: Question and Answer » json
Viewing all articles
Browse latest Browse all 148

How to send long JSON objects (polygon geometry, table rows) in POST request to Geoprocessing Service?

$
0
0

I am seeking to understand my options for sending long JSON objects in a request to a Geoprocessing Service.

In particular, I am looking for some example code to illustrate how to include two long JSON objects (one a polygon geometry as a coordinate string, the other a table as rows of ASCII text with the first row being the column headings) into a POST request to my Geoprocessing Service, and then hints as to how best to read them as parameters in the Python script that I’ve published as my Geoprocessing Service.

At http://help.arcgis.com/en/arcgisserver/10.0/apis/rest/gettingstarted.html it says:

When using the REST API, you will normally use an HTML GET method in a
form. When you use GET, the entire request is encoded in the URL. This
is the preferred method to use whenever possible. However, in this
mode, a URL is limited to as few as 1024 characters depending on the
browser. Thus, if you have a long JSON object to include in the
request, you will need to use POST.

A second option, when using certain Geometry Service and Geoprocessing
Service operations, is to continue to use GET and to specify a URL to
the input JSON object contained in a file on a public server.

I’m familiar with using a GET method when the parameters can all fit into a URL that I can paste into a browser.

I’m also comfortable with the idea of using GET to specify a URL to input JSON objects that are contained in files on a public server. However, I am prevented from using this method this because my client does not want files placed on a public server.

That leaves me with having two long JSON objects to include in the request and having to use POST which is a method beyond my current level of understanding.

If no example code is readily available, then any hints on how to do this will be greatly appreciated.


Viewing all articles
Browse latest Browse all 148

Trending Articles