I recently had to regenerate a joined view layer in my organization due to having updated the schema of the underlying feature services. Since this joined view was deployed across a couple of web maps with valid symbology and pop-up definitions, I elected to update the service URL in the web maps directly using the ArcGIS API for Python:
from arcgis.gis import GIS
gis = GIS(url, un, pw)
webmap = gis.content.get(webmapid)
map_def = webmap.get_data()
new_service_url = "https://services6.arc..."
map_def['operationalLayers'][1]['url'] = new_service_url
webmap.update(data=map_def)
This method worked like a charm and when the webmap is opened in MapViewer or its definition is retrieved using the above method, the appropriate layer is being displayed. However, in the item details page for these web maps, if I click the layer that I updated the service url for, it is still pointing to the previous joined view layer.
Any ideas?
Solved! Go to Solution.
If you read the web map JSON in a text editor you should see an Item ID associated with the layer, it needs to be updated independent of the URL.
If you read the web map JSON in a text editor you should see an Item ID associated with the layer, it needs to be updated independent of the URL.
Worked like a charm. I guess I assumed that the service details like that were defined from the REST url and didn't need to be manipulated separately.