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!
I would like to say that I'm still having this problem. I'm basically in the exact same scenario as you, I'm able to generate the token all fine and dandy, but then when i do a post request to this endpoint, I'm always getting an identical 200 response. I've sent it working tokens, intentionally broken tokens, no token at all, no body at all, basically everything i can think of and nothing changes what I'm getting. This is infuriating me to no end and i was wondering if you happened to find the solution to this?
Hello Graham,
Unfortunately I never figured this out. Part of the reason I was doing this was to see if I could make a custom post request to generate reports for multiple records at once, the way you can in the survey123 site. But I gave up and reworked my processes in Make to just make a report for each record.
I wish I had something to show you, but I'm using the built in survey123 report creator module in Make now. I cant see the full request its actually sending on the backend, just the inputs and results.
Pretty annoying, this isnt the first time I gave up on figuring something out with survey123 and just went with a different solution even if its incomplete.
*duplicate post*, meant to post as a reply above