Learning the host server url by using the REST API

10-04-2019 09:26 AM
New Contributor III


My feature service URL's are like this:

"https://services1.arcgis.com/[Organization ID]/arcgis/rest/services/[Feature Service Name]/FeatureSe..."

Why does my organization have this server url, namely "https://services1.arcgis.com"? Why is it "services1"? Why not "services2" or "services3"? Can this server url be different for different organizations that have an ArcGISOnline account?

Related, but a different question. I want to learn this host server url only via Rest API. 

https://www.arcgis.com/sharing/rest/content/users/[My Username]/

I can use the url above to get the content (that is, all items) in my account, find a service (for example, feature service, tile service etc.), and get the URL of that specific service. From the URL of that service, I can figure out the host service URL. However, if I don't have any service in my content, there seems to be no way to learn the host server URL by using the REST API.

Just an example to clarify what I mean. Let's assume that I know the username and password of a specific user on ArcGISOnline. By using this information, I can generate a token. By using this token, I can do lots of things, such as displaying the items on his content, learning which groups he is a member of, upload an item to his content, creating a feature service etc. However, I want to learn the URL of the server in which his feature services exist. More specifically, I want to learn the <host> part of its ARCGIS Server endpoint URL structure which you can see in the below documentation:

Get started—ArcGIS REST API: Services Directory | ArcGIS for Developers 

How can I do that?

1 Reply
New Contributor II

This would be a nice feature to include. I'm kind of surprised that it isn't included in the sharing/rest/portals/self/properties API call.

0 Kudos