Generate PDF Report Automation Code

1199
1
Jump to solution
07-06-2022 07:22 AM
GIS_Fox
Occasional Contributor III

Hi All,

I am preparing to build either an API Webhook series or code another automation workflow to generate reports via Survey123 and email them. Is there documentation or a method to tell Survey123 to automatically select the UID, URL, or GUID of a survey just performed or edited and have it initiate the process to generate a PDF report? Emailing is simple enough but the Survey123 actions are what I do not know.

Setting or having webhooks watch for new or edited features is simple but with new feature or edited features, I am trying to find out how to then tell survey123 to make a PDF report of what was just done and either store or send it elsewhere. Much like Integromat/Make does with URL and connector lines, however without seeing the backend I'm not sure how I would do this.

Many thanks,

 

Jansen Lyons - Records and GIS Section - Public Works - City of Rio Rancho, NM
1 Solution

Accepted Solutions
ZacharySutherby
Esri Regular Contributor

Hello @GIS_Fox

We have our Report REST API documented in our developer documentation. What you would need to do is send a createReport/submitJob POST request with the required parameters. The createReport task is going to return a Job ID. You would then need to periodically (every 15s or so) send a /jobs/<jobId> GET request based on the jobStatus. If it's still executing reissue the request, if it completed you can then extract the report(s) from the resultFiles property located in the resultInfo. 

Here's a little graphic that demonstrates the workflow: 

ZacharySutherby_0-1657146690421.png

As a side note (I'm not sure how you are planning on implementing your workflow) we have a number of methods available in the ArcGIS API for Python that can be used to automate the generation of Survey123 Reports. Please see this sample Jupyter Notebook for reference. 

Thank you,
Zach

View solution in original post

1 Reply
ZacharySutherby
Esri Regular Contributor

Hello @GIS_Fox

We have our Report REST API documented in our developer documentation. What you would need to do is send a createReport/submitJob POST request with the required parameters. The createReport task is going to return a Job ID. You would then need to periodically (every 15s or so) send a /jobs/<jobId> GET request based on the jobStatus. If it's still executing reissue the request, if it completed you can then extract the report(s) from the resultFiles property located in the resultInfo. 

Here's a little graphic that demonstrates the workflow: 

ZacharySutherby_0-1657146690421.png

As a side note (I'm not sure how you are planning on implementing your workflow) we have a number of methods available in the ArcGIS API for Python that can be used to automate the generation of Survey123 Reports. Please see this sample Jupyter Notebook for reference. 

Thank you,
Zach