Hello, I'm trying to generate a Survey123 report with the report api https://developers.arcgis.com/survey123/api-reference/rest/report/
Specifically using the Create Report operation. Ultimately I'm trying to setup an automation in Make (integromat), that generates a report for a survey that is hosted on our enterprise portal site. Since that isn't working, I'm stepping back to do some testing to make sure I'm getting the post syntax right and then I can move on to figuring out how to make it work with portal - if possible.
So here I'm trying to generate a report for a survey hosted on arcgis online.
import requests
import json
create_url = "https://survey123.arcgis.com/api/featureReport/createReport"
portal_url = "https://myorg.maps.arcgis.com/"
feature_layer_url = f"url copied from agol"
template_item_id = "template item id"
token = "token"
create_url = f"https://survey123.arcgis.com/api/featureReport/createReport"
parameters = {
"featureLayerUrl": feature_layer_url,"queryParameters": '{"where":"objectid=1"}',"templateItemId": template_item_id,"portalUrl": portal_url, "token": token,"f": "json"
}
response = requests.request("POST", create_url, data=parameters)
print(response)
The token I'm getting from another script running generateToken, seems to work fine, so I'm just pasting that in for testing.
Problem is I'm just getting a general 200 response that doesn't tell me anything. The report isn't getting generated, and even if I change some of the parameters to gibberish I still get a 200 response so I must be doing something wrong here. I don't have much experience working with post requests unfortunately.
Does the feature layer url have to be the form? I'm assuming it can be one of the 2 feature layers that get created with a new survey. With the arcgis api for python I usually reference the form.
If I was doing this only in python I'd use the generate_report method in the api for python. But I have to use rest since in Make I'm trying to setup a post request, so I need to use rest in my python testing so I can figure out why its not working on the Make side.
Can anyone provide an example python script to generate a survey report using the rest api? Thanks!