Select to view content in your preferred language

Automate Publishing of Survey123 Project

4156
23
08-30-2021 11:49 AM
jaykapalczynski
Honored 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
Honored 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
Honored 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 Esteemed 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
Honored 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 Esteemed 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
Honored 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 Esteemed 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
by Anonymous User
Not applicable

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
Regular Contributor

@jaykapalczynski I still regularly use @Anonymous User '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