Select to view content in your preferred language

Update sourceUrl for a feature service?

132
2
Tuesday
Labels (1)
ElisabethFenn
New Contributor II

For referenced feature layers brought into AGO from our enterprise server I can access the sourceUrl using item.sourceUrl. Is it possible to also update the sourceUrl?

I'd like to point the referenced feature layer at a different REST URL to update the underlying data without creating a new item and losing popup configuration, etc.

0 Kudos
2 Replies
JakeSkinner
Esri Esteemed Contributor

Hi @ElisabethFenn,

You can do this easily with the AGOL Assistant.  

JakeSkinner_0-1719486114646.png

 

0 Kudos
EarlMedina
Esri Regular Contributor

I've not tested this, but assuming the schema is exactly the same then you should be able to do this for your specific case (i.e., you added Enterprise Feature Services as items to your AGOL content).

 

from arcgis.gis import GIS
gis = GIS("https://www.arcgis.com", "user", "passwd")

new_url = "https://sampleserver6.arcgisonline.com/arcgis/rest/services/RedlandsEmergencyVehicles/FeatureServer"
your_item_id = "4567fd6780e74ccb877fasdfghjlkl"
item = gis.content.get(your_item_id) # here the item id of the Feature Service you added to AGOL
item_properties = {"url": new_url}
item.update(item_properties=item_properties)

 

 

Coding this may not be worthwhile for a few urls. As Jake mentioned, you can do the same thing rather quickly in AGO Assistant.

0 Kudos