Starting today, the package will include a property that will allow users to directly access the site's hosting servers in either the federated environment or on ArcGIS Online. To access this, you must be an administrator user of your site. You create the manageorg.Administration object, and then you can navigate around your whole system. This object has a new function called hostingServer(). It has an optional parameter called portalId which represents the organizational identifier. If the user does not know it, a None can be passed and the package will try and discover the id.
The results are as follows:
- If the site is ArcGIS Online, a list of hostedservice.service.Services objects is returned
- If the site is Portal, a list of AGSAdministration objects is returned
Lets look at some sample code:
import arcrest
if __name__ == "__main__":
username = "A USERNAME"
pw = "PASSWORD"
adminUrl = "https:///portal/sharing/rest
tokenUrl = "https:///portal/sharing/rest/generateToken"
sh = arcrest.PortalTokenSecurityHandler(username=username, password=pw,
org_url=adminUrl,
token_url=tokenUrl)
print sh.token
admin = arcrest.manageorg.Administration(url=adminUrl,
securityHandler=sh)
servers = admin.hostingServers()
for s in servers:
if isinstance(s, arcrest.manageags.AGSAdministration):
print s.info.fullVersion
print s.resources
elif isinstance(s, arcrest.hostedservice.Services):
print s.currentVersion
Depending on what information you provide for the manageorg.Adminstration function, you will get back different object. If you pass in a AGOLTokenHandler, and connect to AGOL, you will get back one object, and if you pass a Portal reference, you will get back the federated and hosted server information.
This is an effort to make managing AGOL and Portal sites easier for administrators. I hope this helps everyone out there!
This is an effort to make managing AGOL and Portal sites easier for administrators. I hope this helps everyone out there!
Enjoy,
A