I'd like to set the 'offline' object within the applicationProperties of a web map object when that object does not exist, using the python API. I can update the applicationProperties object with the following code, which updates the object locally in the session, but I'd like to write the property back to the portal item.
For example, consider a web map with the following applicationProperties object:
"applicationProperties": {
"viewing": {
"routing": {
"enabled": true
},
"basemapGallery": {
"enabled": true
},
"measure": {
"enabled": true
}
}
}
I'd like to add this object:
"offline": {
"editableLayers": {
"download": "features",
"sync": "syncFeaturesUploadAttachments"
},
"readonlyLayers": {
"downloadAttachments": false
}
}
So that the applicationProperties looks like this:
"applicationProperties": {
"viewing": {
"routing": {
"enabled": true
},
"basemapGallery": {
"enabled": true
},
"measure": {
"enabled": true
}
},
"offline": {
"editableLayers": {
"download": "features",
"sync": "syncFeaturesUploadAttachments"
},
"readonlyLayers": {
"downloadAttachments": false
}
}
}
I can update the object locally with the following code...
item = gis.content.get(item_id)
item_json = item.get_data()
app_props = item_json['applicationProperties']
if not 'offline' in app_props:
off_line = json.loads('{"offline": {"editableLayers": {"download": "features", "sync": "syncFeaturesUploadAttachments"}, "readonlyLayers": {"downloadAttachments": false}}}')
app_props.update(off_line)
... but I'd like to write/save the new applicationProperties config back to the web map portal item.
Is this possible with the python (or any) API?