AnsweredAssumed Answered

REST API Example

Question asked by piterpaulppp on Oct 27, 2016
Latest reply on Nov 6, 2016 by piterpaulppp

The task - to get features in format json from ArcGIS Server (map service or geometry service)
I should use ArcGIS REST API with request and use large external file with parametres.
Its format  json and its content - all the features where uniq1 in (1,2,3,4,5, ..., 100001)
"Uniq1": "1",
"Uniq1": "2", ...
I found an unclear syntax/example of version 9.3.
I have version 10.4 - I need some working example on online ArcGIS Server services like this one

https://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Petroleum/KSFields/MapServer/0

 

Here is the help for 9.3 (question - if it is actual now, or API has changed for 10.4?)

6. Understand options for sending long JSON objects in a request (Getting Started with GeoServices REST API )
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.

Syntax: geometries = { "url": "<URL to file>"}
Example: geometries = { "url": "http: //myserver/mygeometries/afile.txt"}

http: // myserver / arcgis / rest / services / Geometry / GeometryServer / project? inSR = 4326 & outSR = 54004 & geometries = { "url": "http: //myserver/mygeometries/afile.txt"}

Outcomes