I'm having trouble accessing an item (zipped shapefile) that I have created with the ExtractData analysis tool. Here is what I've done so far:
1) Extract Data with the ExtractData by submitting a new job (SUCCESS)
2) Check the job status and wait for a status of esriJobSucceeded (SUCCESS)
3) Capture the analysis results which includes a url to the item that was created (SUCCESS)
4) Download the created item using the url with data appended to the end of the url like so - https://www.arcgis.com/sharing/rest/content/items/<item id>/data
I replace the <item id> with my items id. (FAILED)
What I've found is that in my content on AGOL, the newly created zip file is private and is not accessible to me as the creator or to everyone (public). This gives me the error "You do not have permissions to access this resource or perform this operation." which I would expect at this point. If I go into my AGOL content and manually change the access to everyone (public) I am then able to download the file by going to the url https://www.arcgis.com/sharing/rest/content/items/<item id>/data
However, I want to automate this process and I can't figure out how. Any time I try to change the access on the item through the Share Item endpoint I get an invalid token response. Perhaps there is something I'm missing?
Thanks for any help or ideas!