We've recently changed our production servers. I changed the url for the feature layers but the problem is, even if they are displaying correctly in AGOL, when I look at the json for the webmap feature layer objects, the old server url is still being returned.
if req.status_code == 200:
target = GIS('https://mysite.com', 'myname', 'mypassword')
newsearch = target.content.search(query="", item_type = "Web Map", max_items = 1000)
for item in newsearch:
if item.id == "1111111111111111etc":
filewriter.writerow([item.title, " ", item.owner, item.type, item.homepage, item.url])
newmap = WebMap(item)
for layer in newmap.layers:
my_dict = dict(layer)
new_id = my_dict.get("itemId")
layertype = my_dict.get("layerType")
new_url = my_dict.get("url")
nextstr = new_url.find("https://oldserver")
if nextstr != -1: #found a url with old server name
#should mention that this method updates the url but the item is still pointing to the old service.
nexturl = my_dict.get("url")
if new_id is not None:
#feature layer home page construct
filewriter.writerow([" ", layer.title, " ", layertype, my_dict.get("itemId"), my_dict.get("url"), layer.visibility])
Any idea on how I can resolve this. The item is displaying correctly in AGOL (url property was changed) but when I query the web map, list out the feature layers, the old server name is still displayed which is a problem.