Hi, just trying to share a map I made in the new Map Viewer by its shortened URL (example: https://arcg.is/xxxxxx). When I'm in classic mode and click "Share" it brings me to the popup where I can choose who to share it with, or there is the "Link to this map" section which has the shortened URL, but this URL only brings me to the classic map viewer. When I click "Share map" in the new map viewer, it just gives me the option to set my sharing level or group sharing level. No URL option.
If I click on the map from the "Contents" tab, under "Details" there is a url sharing option, but this only directs me to the same details page where you can choose to open the map however, but not the map itself.
I can also figure out how to find the URL when putting the map through an app, but unfortunately the app doesn't let me edit chosen attribute fields (or at least I don't know how to get it to let me do this), so the app doesn't really work for my purposes.
So, how do I find out the shortened AGOL URL for my map using the new map viewer that brings viewers directly to the map?
There's not an "easy" way to do this, but if you really want to know...
Clicking "Share" in the classic map viewer sends a GET request to https://arcg.is/prod/shorten with the map URL as the parameter longUrl. It also includes your current AGOL token, and requests the response be formatted as JSON.
A script then takes the response, finds the shortened URL, and puts it in the sharing box.
If you wanted, you could really submit anything to that URL. For instance, your question: https://arcg.is/prod/shorten?longUrl=https://community.esri.com/t5/arcgis-online-questions/how-to-ge...
Which returns:
{
"status_code": 200,
"status_txt": "OK",
"data": {
"long_url": "https://community.esri.com/t5/arcgis-online-questions/how-to-get-shortened-url-for-new-map-viewer-maps/m-p/1180015/highlight/true",
"url": "https://arcg.is/1L890b",
"hash": "1L890b",
"global_hash": "1L890b",
"new_hash": 1
}
}
It's not exactly convenient, but you can easily generate a short arcg.is link for your new maps.