Morning,
I am trying to create a script that searches an items dependencies & data, finds legacy URL's/services and updates these to the new version of that URL/service.
Example of script
orig_data = item.getdata()
new_data = orig_data.replace(old_url, new_url)
item.update(item_properties=None, data=new_data, thumbnail=None, metadata=None)
The outcome of this script, when used with WAB Apps, is the app breaking and returning an error page of "'False' is undefined". What is wrong with the above methodology for WAB Apps? Is there an alternative workflow to achieve the same end goal of updating legacy dependencies that are baked into a WAB App?
Solved! Go to Solution.
Okay, if that is what you're trying to update the workflow you described isn't quite what I had in mind. What happens if instead you do:
app_data = item.getdata()
app_data['geometryService'] = 'https://thisisanupdate.com'
item_properties = {"text": json.dumps(app_data)}
app.update(item_properties=item_properties)
This update is successful for me and the application continues to work.
Hi Angus,
Exactly what are you trying to update in the app? URLs defined in widgets (e.g., Geoprocessing Widget task URL)? Those would appear in the Web Application item data, otherwise any displayed layers should come from the underlying Web Map.
-Earl
The geometry service that the Portal is configured to use is baked into the WAB app data. This is not configurable in the app, a widget or web map.
Okay, if that is what you're trying to update the workflow you described isn't quite what I had in mind. What happens if instead you do:
app_data = item.getdata()
app_data['geometryService'] = 'https://thisisanupdate.com'
item_properties = {"text": json.dumps(app_data)}
app.update(item_properties=item_properties)
This update is successful for me and the application continues to work.