I need to programmatically call the analysis extract data endpoint (https://developers.arcgis.com/rest/analysis/api-reference/extract-data.htm). I've written client side and server side code in js/node and I can't seem to get either approach to work.
On the client side, I get CORS issues, and in the nodejs code, the endpoint responds saying that anonymous access isn't allowed. I am using a valid token and I'm using an account that is able to use this tool from the webmap viewer, so I assume my permissions are valid as well.
I'm trying to hit: https://analysis5.arcgis.com/arcgis/rest/services/tasks/GPServer/ExtractData/submitJob because this is the URL that I saw the webmap viewer was using. Although I've also tried other instances of this service (analysis, analysis1, analysis2, etc).
I've created a github repo with the code: https://github.com/danbritt/data-extractor-example
Any help would be appreciated, as this is an important tool that I want to provide in a project I'm working on.
Solved! Go to Solution.
Figured it out. This endpoint only accepts application/x-www-form-urlencoded requests, and I was sending JSON, so it didn't see any of the parameters I was passing, including the token.
Figured it out. This endpoint only accepts application/x-www-form-urlencoded requests, and I was sending JSON, so it didn't see any of the parameters I was passing, including the token.