Select to view content in your preferred language

Accessing item created with ExtractData

550
2
Jump to solution
02-13-2019 01:05 PM
JoeEastman
New Contributor

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! 

0 Kudos
1 Solution

Accepted Solutions
JoeEastman
New Contributor

I ended up finding the solution for anyone who finds this in the future.

My only issue was that I was using a portal token in my API call and I needed a server token. I've been grabbing a portal token from my AGOL account and using that in all my calls. It's always worked until now. Moving forward I'll be requesting all my tokens from the getToken endpoint and all should be good!

View solution in original post

2 Replies
JoeEastman
New Contributor

I ended up finding the solution for anyone who finds this in the future.

My only issue was that I was using a portal token in my API call and I needed a server token. I've been grabbing a portal token from my AGOL account and using that in all my calls. It's always worked until now. Moving forward I'll be requesting all my tokens from the getToken endpoint and all should be good!

YashMore
New Contributor

@JoeEastman Hi Joe, would it be possible for you to share the code for this application? Especially steps 3 and 4 which would allow users to download the generated files directly through the application. Thank you!

0 Kudos