Select to view content in your preferred language

Repair URL (Rest) Data Source

883
3
01-26-2023 03:15 PM
sgambrel_Bouldercounty
Frequent Contributor

Hello,

I have a map that I use often that pulls in several web layers and has some complex configuration applied.  For whatever reason the number at the end of each REST URL has changed (...arcgis/rest/services/FeatureServer/<NUMBER>), completely fouling the map.  I would like to repair or update the data source but I appear unable to?  All I need to do is change the number at the end of the URL, but it appears that I am unable to do this...  Or enter the full updated URL...  Or do anything besides remove and re-add the layer.

I have several fairly complex configurations set up on the layers on this map (def queries, labeling, symbology), so removing and re-adding is extremely unpalatable, expecially if this happens again in the future.

PLEASE tell me that there is an ability to update / repair the data source for a REST endpoint / URL.

Thank you! 

0 Kudos
3 Replies
AndreasHall
Esri Contributor

Hi, if it is just the last number that has changed, the layer ID, you an republish from Pro with the layer IDs you need. You can read more about it here: Assign layer IDs—ArcGIS Pro | Documentation

When using workflows where you often republish services, perhaps with new layers added, best practice is to author layers and stand-alone tables with static IDs (se above link how to do that).

It is also possible to access the JSON file of a web map and there edit the IDs of the layers that the map is reading, thus changing the definition of the map instead.  ArcGIS Assistant (esri-ps.com) can be used for these kinds of workflows, but proceed with caution. It is quite easy to wreck the web map completely by editing the JSON code in the wrong way.

0 Kudos
sgambrel_Bouldercounty
Frequent Contributor

Thanks, the issue truly is with just the number at the end - but unfortunately this is somebody else's service that I am consuming, so I have no control over the number at the end.

AndreasHall
Esri Contributor

Then editing the JSON file is the way to go. You can make a local copy and use a search and replace workflow in any text editor. Below is an example how the JSON file refers to a feature layer in the map. You can see that it uses both the URL and the item-ID. Be sure to keep a backup copy of the JSON file on your hardrive so that you can undo your edits if something breakes.

AndreasHall_0-1675231553795.png

 

0 Kudos