Change a feature layer Url

1376
2
Jump to solution
03-22-2018 01:09 PM
MarkCederholm
Occasional Contributor III

Is it possible to change the Url of a FeatureLayer?  For example, changing

"https://oldserver/arcgis/rest/services/myfolder/mymapservice/MapServer/1"

to

"https://newserver/arcgis/rest/services/myfolder/mymapservice/MapServer/1"

When I try this:

fLyr.manager.update_definition({ "url":sNewLayerUrl })

I get "RuntimeError: Invalid URL (Error Code: 400)". 

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
MarcLEMAIRE
New Contributor III

hello Mark,

don't go so far, you don't need to go until the FeatureLayer object

Stay at the "Item" level, you just have to change the Item properties

item.update(item_properties={'url':newUrlString})

View solution in original post

2 Replies
MarcLEMAIRE
New Contributor III

hello Mark,

don't go so far, you don't need to go until the FeatureLayer object

Stay at the "Item" level, you just have to change the Item properties

item.update(item_properties={'url':newUrlString})

MarkCederholm
Occasional Contributor III

It works, thanks.

0 Kudos