Hello I would like to use the API REST to interpolate a set of points stored in an ArcGIS Online layer.
I'm using this URL:
http: //www.arcgis.com/sharing/rest/content/features/analyze/InterpolatePoints/submitJob?token=ValidToken&url=67421744b8b549b49b5fb45ff836d45f&field=aqi&f=json
With a valid Token and in the url parameter the id of my points layer. But I get this result: {"error":{"code":400,"message":"Must specify either sourceUrl, input file or text."}}
How should I specify the input parameter if I want to use my layer stored in ArcGIS Online?
Thanks!
Solved! Go to Solution.
You're using the wrong endpoint. If you go through ArcGIS REST API: Spatial Analysis Service | ArcGIS for Developers you'll see references to for example http://<analysis url>/InterpolatePoints, <analysis url> is your GP Server endpoint. Typically with an ArcGIS Online account this is analysis.arcgis.com/arcgis/rest/services/tasks/GPServer. So to submit an interpolate points request you would use http://analysis.arcgis.com/arcgis/rest/services/tasks/GPServer/InterpolatePoints/submitJob
You're using the wrong endpoint. If you go through ArcGIS REST API: Spatial Analysis Service | ArcGIS for Developers you'll see references to for example http://<analysis url>/InterpolatePoints, <analysis url> is your GP Server endpoint. Typically with an ArcGIS Online account this is analysis.arcgis.com/arcgis/rest/services/tasks/GPServer. So to submit an interpolate points request you would use http://analysis.arcgis.com/arcgis/rest/services/tasks/GPServer/InterpolatePoints/submitJob
Thanks for your answer, I changed the endpoint and now I getting this error:
{"error":{"code":401,"message":"You do not have permissions to use this resource.","details":[]}}
My layer is public, and the token is valid, do you know what could be the problem?
The analysis services consume credits, so you would need an organizational account and be authorized by your admin to use these services...
I'm in an organizational account, I didn't know I should be authorized to use the service.
Thank you!
You can check by going to https://arcgistest.maps.arcgis.com/sharing/rest/portals/self?f=pjson&token=<token> and verify you have the "premium:user:spatialanalysis" privilege:
(of course use your own org. url instead of arcgistest.maps.arcgis.com)
Yes, I'm missing it.
Thanks!