Solved! Go to Solution.
GET http://www.arcgis.com/sharing/rest/community/users?num=100&q=orgid%yourorganizationid&f=json& HTTP/1.1
var portal = new ArcGISPortal(); portal.SearchUsersAsync(new SearchParameters() { Limit = 100, QueryString = "orgid:YourId" }, (info, exception) => { if (info != null) { MessageBox.Show(info.Results.Count().ToString()); } });
GET http://www.arcgis.com/sharing/rest/community/users?num=100&q=orgid%yourorganizationid&f=json& HTTP/1.1
var portal = new ArcGISPortal(); portal.SearchUsersAsync(new SearchParameters() { Limit = 100, QueryString = "orgid:YourId" }, (info, exception) => { if (info != null) { MessageBox.Show(info.Results.Count().ToString()); } });
I haven't seen really good place get that information so I have been using this way to get it from AGOL directly.
In case anyone needs it:
For ArcGIS Online, the org id is listed in:
https://<orgName>.maps.arcgis.com/sharing/rest/portals/self?f=json&token=
the json format and token must be provided, as it seems you can't navigate this endpoint using html, nor without a token.
Look for the value of the user.orgId key
For Portal for ArcGIS that uses AD SSO, the orgid is listed in:
https://<hostMachine>/portal/sharing/rest/portals/self
https://<hostMachine>/portal/sharing/rest/portals/self?f=pjson
The json format is optional.
The token seems to be read from your SSO on your network, so it does not need to be provided.
Look for the value of the id key
I would like to point out that as of the January 2024, the method described for finding the organization ID for an AGOL organization no longer works. When goes to the endpoint described by following the link: "https://<orgName>.maps.arcgis.com/sharing/rest/portals/self?f=json&token=" there is no entry or line for "org.id" or "user.orgId".
The organization ID is not shared at this endpoint.
Hey Ian, did you find out which endpoint returns this now? This seems to be the most recent comment on this topic.
I'm not sure how to edit my post, but just figured it out. The endpoint does return that information, once you post to that endpoint with the appropriate token. Without the token it there is a chunk of returned information that is missing.
Tested Feb 2024
IdentityManager.Current.GenerateCredentialAsync( "http://www.arcgis.com/sharing/rest/", "xxxx", // here should be your username "xxx", // here should be your password (credential, ex) => { if (ex != null) { MessageBox.Show(ex.ToString()); return; } var portal = new ArcGISPortal(); portal.Token = credential.Token; portal.SearchUsersAsync( new SearchParameters() { Limit = 100, QueryString = "orgid:yourid" }, (info, exception) => { if (info != null) { MessageBox.Show(info.Results.Count().ToString()); } }); }); var portal1 = new ArcGISPortal(); portal1.SearchUsersAsync( new SearchParameters() { Limit = 100, QueryString = "orgid:yourid" }, (info, exception) => { if (info != null) { MessageBox.Show(info.Results.Count().ToString()); } });
GET http://www.arcgis.com/sharing/rest/community/users?num=100&q=orgid%<idhere>&f=json& HTTP/1.1 GET http://www.arcgis.com/sharing/rest/community/users?num=100&q=orgid%<idhere>&f=json&token=yNMOPUrVkzMRwYdNWYoYY4I0sOFHKh4IRFwFM6Lc8NFJYXqrg-lmgpwEruT6u68e_VGWsAykDCcUgUxsOxgGHXLzQ5aZ56k-98acP8bSX2UQeYWesde4a-HXL_gIml2B& HTTP/1.1