Automate Publishing of Survey123 Project

1372
23
08-30-2021 11:49 AM
jaykapalczynski
Frequent Contributor

I have an existing project that has a few media files.  I have frequent updates to these media files as well as occasional form updates.  I need a python script that I can run via scheduler that will publish this project nightly.  I have read a bunch of posts but cant find anything clearly stated that shows how to do this.  Is there anyone out there that can help provide a solution?

0 Kudos
23 Replies
jaykapalczynski
Frequent Contributor

I found this  https://www.arcgis.com/home/item.html?id=521168944ace40d0827991eeeba03689 

I am just trying to figure out what is happening....I dont even know if I can still use this as its from 2017 !!

  • What Zip file? 
  • Do I need to zip up the whole project or just the media files?

I'm really confused as to what is going on....I assume that I can use this to update my media files daily if need be.

 

0 Kudos
jaykapalczynski
Frequent Contributor

What is the ago.AGOLHelper

I know I have the correct UserName and Password but I am getting a NULL for the agol_helper.token

agol_helper.token = NULL

agol_helper = ago.AGOLHelper(portal_url)
print ("...Authenticating")
# login
agol_helper.login(credentials['userName'], credentials['passWord'])

print ("...Querying")
# get the name of the zip file
serviceInfo = getServiceDefinition(agol_helper.token, itemID)

 

 

0 Kudos
DougBrowning
MVP Notable Contributor

There is a new way now using Linked Content.  But it may have some issues it looks like. See this post  https://community.esri.com/t5/arcgis-survey123-questions/auto-update-select-one-from-file-list-and-t...

The other new way to to link to a feature service but that would require being online.  It is in the early adopter only for now.

Hope that helps

0 Kudos
jaykapalczynski
Frequent Contributor

There are other things my lists do as in prepopulate etc....

I am looking for an automated process that I can replace the Media Files at will and then automatically republish the project nightly.  Preferable from Python script.

0 Kudos
DougBrowning
MVP Notable Contributor

You can link all your lists to a stand alone CSV that you store in AGOL.  Works just like the media folder but no need to republish.  Then you use Python to update that item.  The form then sees this change and updates.  Check out select_one_from_file.  

0 Kudos
jaykapalczynski
Frequent Contributor

So right now I have 4 media files. The excel file points to them.  

  • Do I simply add these CSV files to my AGOL folder?
  • How do I update the excel file to point to these files in AGOL?
  • I would then republish and it should now point to the files in AGOL???
  • How?

Are there any examples of how to update these tables via python?

 

0 Kudos
DougBrowning
MVP Notable Contributor

It is all in the link above or this one https://community.esri.com/t5/arcgis-survey123-questions/can-a-linked-csv-file-on-agol-be-automatica...

It is actually really easy to link.  Then the post I linked above had the python code to update the item in AGOL.

 

0 Kudos
Philip-Wilson
Esri Notable Contributor

Hi @jaykapalczynski,

You can use Linked Content to update choice lists from a hosted CSV file everytime the CSV file is updated and the survey info page is accessed. This avoids having to re-publish the survey just to update the choice list.

Please refer to external choice list section in documentation, with explanation about Linked Conent:

https://doc.arcgis.com/en/survey123/desktop/create-surveys/xlsformessentials.htm#ESRI_SECTION1_34A4D...

Regards,

Phil.

0 Kudos
JamesKelly4
Occasional Contributor

@jaykapalczynski I still regularly use @Philip-Wilson 's script provided in this blog. You have to save the python2.7 script in the "download_folder" and you won't get the zip message error anymore. 

0 Kudos