AnsweredAssumed Answered

Issues with AGOL replica removal using REST API and Python

Question asked by leftieant76 on Mar 24, 2018

Hi everyone. Not quite where the home for this post should be, but I'll start in the AGOL group as you have all proven to be a very smart bunch of people in the past.

 

I'm currently banging my head against a brick wall trying to work out a programmatic way to list and then subsequently unregister replicas on an AGOL feature service.

 

This is what I've got in place at the moment:

 

1 - using https://www.arcgis.com/sharing/rest/oauth2/token/  to generate a token, with Client ID and Client Secret sourced from developers.arcgis.com

2 - using Python 'requests' library to pass a POST request to http://feature_service_url/replicas, with the token as payload and also f = pjson

 

This method above doesn't fail, but returns an empty JSON as the result.

If, however, I substitute in a token generated from the URL when I am logged into www.arcgis.com and view a feature service URL, a legitimate result will be returned.

 

What I can't work out is why will no result be returned when I am using a token generated by Step 1 above. I have used this in numerous other applications to interact with feature services without issue.

 

Can anyone shed any light on this?

 

Thanks

 

Anthony Cheesman

Outcomes