2

I have an ArcGIS Server 10.0 geoprocessing task with a REST endpoint something like this: http://server/arcgis/rest/services/MyService/GPServer/MyTask

The task takes a parameter. I was hoping I could pass it like so: http://server/arcgis/rest/services/MyService/GPServer/MyTask?param=Value&f=pjson

... and get the result back as JSON. But it doesn't seem to respond to the parameter - all I get is static metadata about the task. There is the option of submitting a job, but my JavaScript will have no idea when it finishes, so I would have to keep checking the job till it's done and then get the results via individual URLs:

http://server/arcgis/rest/services/MyService/GPServer/MyTask/jobs/a72h72hd6d6g26gdh7/results/someParam?f=pjson

Is there really no way to just get the results as JSON? And pass the parameter in the first place?

2 Answers 2

9

You should have a look at the REST Help for GP Task

To run the geoprocessing task, you need to provide an input. If your GP Service is Synchronous, then you need to call the Execute Operation. If your service is Asynchronous, then you need to call the SubmitJob Operation. Both of them take their input parameter in JSON Format.

In the case of a Synchronous service, you get the response directly.

In the case of an Asynchronous Service, you get a jobid back. You need to query the status of the job Id, and once the process is complete, you can get the results, by querying the GP Result Operation.

All of this can be done through simple Get resquests and JSON format

2

Are you publishing or want to publish asynchronous service/geo-processing service, that will not show the response in the form of json by calling the service or pasting the url in the browser. If you publish the synchronous service your URL paste in the browser and even the call from JavaScript thorough the calling mechanism will send response to the responder/function registered with the call. This is a setting while you publish the GP service by manager or by ArcCatalog.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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