I'm trying to use the arcgis API to write a script that calls the GenerateReport REST API. The first step is to authenticate, and I am stuck there.
I first get the token with:
curl --location -g --request POST 'https://www.arcgis.com/sharing/rest/oauth2/token?
grant_type=client_credentials&
client_id=MYAPPID&
client_secret=MYAPPSECRET'
and that works, it returns:
{"access_token":"_J3J_S_6kgKgH9vwGx4cUGa2Vj4qC0odcoe9ZBscf8nOVRlrcizRbDJxDCPar9C6zfQyp4er3lNhl5IfGs8UV5TKLZXMKtDm9......etc",
"expires_in":7200}
But then I try to create a report with
curl --location -g --request POST 'https://survey123.arcgis.com/api/featureReport/createReport?
featureLayerUrl=https://services.arcgis.com/oEazpvC7G00gPDRM/arcgis/rest/services/service_51c9906968804a1e89fedfc4804fad3f/FeatureServer&
queryParameters={}&
templateItemId=6b17895629ce4bcb87938d0381f721f2&
token=_J3J_S_6kgKgH9vwGx4cUGa2Vj4qC0odcoe9ZBscf8nOVRlrcizRbDJxDCPar9C6zfQyp4er3lNhl5IfGs8UV5TKLZXMKtDm9......etc'
and the response in an HTML page that says that I have to login.
What am I missing?
Note that the "app" I created in order to get the MYAPPID and MYAPPSECRET were created at https://uscgeography.maps.arcgis.com/
Maybe someone will answer if they see that I also tried in postman:
the above works to get my token. But then I do:
and it still asking me to "Sign in to your ArcGIS Survey123 account"
I also tried login in with my useraneme+password, but the same thing happens. I can get the token, but the token does not work:
then I try to use the token:
I believe you need to add the submitJob portion to the URL:
'http://survey123.arcgis.com/api/featureReport/createReport/submitJob'