Publishing A Survey from Survey123 Programmatically

07-19-2019 07:20 AM
New Contributor

Hi there,

At my workplace, we have developed a survey for our field agents that must be populated with existent information on a fairly regular basis (think about once per hour), and itself populate several online-hosted feature layers for our GIS team on roughly the same time-frame. Naturally, I turned to python and windows task scheduler to try and do this for me, roughly following the same steps as are outlined in this blog post. While the fundamentals of this seem sound, I've run into a couple of issues trying to implement it.

It should first be stated that I was not able to use this code itself, as it relies on the arcrest module (which ESRI seems to recommend against using, in favor of the new python API) and I cannot seem to get any of my layers to download as zipfiles.

Thankfully, my own scripting can do more or less the same thing as Mr. Wilson's, and I was able to get it to the point where the necessary feature layers were updated online and a csv with updated information was created and added to the media folder in the survey. The only step I have left, that I cannot figure out how to get around, is the actual publishing of the survey itself. Is there some method in the api to publish a survey that is currently stored locally? I have been trying to use the arcgis.apps survey123 submodule, but cannot find an "update" method.

Thanks for any help you can offer.

UPDATE: I ended up giving in and using the ArcREST module, using my python3 script to update the csv, then Phil's to save and upload it. I would still love to see how this can be done with the arcgis API, so that I can roll everything into one, but this system works for the time being.

1 Reply
New Contributor


Just happend to see this question!

Have you ever tried the following to update the survey using new python api?

import arcgis
gis = arcgis.GIS(<PORTAL>,<USERNAME>, <PWD>)
gis.content.get(<item id of the survey in portal>).update(data=PATH TO ZIPPED SURVEY FOLDER)


0 Kudos