I would like to query my AGOL organization's History API (https://myorg.maps.arcgis.com/sharing/rest/portals/self/history) without using the ArcGIS Python API, just using Python requests library.
My understanding is I would need to generate an admin token, and use that token to query the API. However, I cannot figure out how to generate a token for this workflow.
res=requests.post("https://myorg.maps.arcgis.com/sharing/rest/generateToken",params=params) returns the error:
["POST request should not contain username and password in the query string."]
Can someone please point me to a clear explanation of how to implement this process?
Solved! Go to Solution.
Can you try it with this Postman REST request?
See if it works there or you get a similar error.
Ah okay. Worked in postman. If I change my Python line from
res=requests.post("https://myorg.maps.arcgis.com/sharing/rest/generateToken",params=params) to
res=requests.post("https://myorg.maps.arcgis.com/sharing/rest/generateToken",data=params)
it works. Got that from https://stackoverflow.com/questions/26615756/python-requests-module-sends-json-string-instead-of-x-w...
Thanks!
Can you try it with this Postman REST request?
See if it works there or you get a similar error.
Ah okay. Worked in postman. If I change my Python line from
res=requests.post("https://myorg.maps.arcgis.com/sharing/rest/generateToken",params=params) to
res=requests.post("https://myorg.maps.arcgis.com/sharing/rest/generateToken",data=params)
it works. Got that from https://stackoverflow.com/questions/26615756/python-requests-module-sends-json-string-instead-of-x-w...
Thanks!