The Portal class is part of the ArcGIS Portal API which provides a way to build applications that work with content from ArcGIS Online or an ArcGIS Portal API. ArcGIS Portal API is software from Esri that customers can deploy either on-premises or in the cloud. ArcGIS Online is Esri's Software as a Service offering that represents GIS as a Service and is implemented using the same technology as ArcGIS Portal.
The Portal API allows application developers to work with users, groups and content hosted within ArcGIS Online or within an ArcGIS Portal. The API allows developers to build web, mobile, and desktop applications that support sharing and collaboration using web maps. Organizational developers can also use the API to build custom applications for their users.
The Portal class provides a view of the portal as seen by the current user, anonymous or logged in. Includes information such as the name, logo, featured items and supported protocols (http vs https) for this portal. If the user is not logged in, this call will return the default view of the portal. If the user is logged in, the view of the portal returned will be specific to the organization that the user belongs to. The default view of the portal is dependent on the culture of the user which is obtained from the users profile.
An instance of Portal is also a Promise. Call the then() method on the Portal instance to execute processes that may only run after the Portal is loaded.
// load the Portal and PortalQueryParams modules
require(["esri/portal/Portal",
"esri/portal/PortalQueryParams",
"dojo/domReady!"], function(Portal, PortalQueryParams) {
portal = new Portal();
// Setting authMode to immediate signs the user in once loaded
portal.authMode = "immediate";
// Once portal is loaded, user signed in
portal.load().then(function() {
console.log(portal);
// Create query parameters for the portal search
// This object autocasts as esri/portal/PortalQueryParams
var queryParams = {
query: "owner:" + portal.user.username,
sortField: "numViews",
sortOrder: "desc",
num: 20
};
// Query the items based on the queryParams created from portal above
portal.queryItems(queryParams).then(createGallery);
});
});
Constructors
new Portal(properties)
properties Object See the properties for a list of all the properties that may be passed into the constructor. |
Property Overview
Name | Type | Summary | |
---|---|---|---|
String | The access level of the organization. more details | more details | |
Boolean | When | more details | |
String | The authentication mode for handling authentication when the user attempts to access a secure resource. more details | more details | |
String[] | Array of trusted servers to send credentials to when making Cross-Origin Resource Sharing (CORS) requests to access services secured with web-tier authentication. more details | more details | |
String | The query that defines the basemaps that should be displayed in the BasemapGallery when useVectorBasemaps is not true. more details | more details | |
String | The Bing key to use for web maps using Bing Maps. more details | more details | |
Boolean | Indicates whether an organization can list applications in the marketplace . more details | more details | |
Boolean | Indicates whether an organization can list data services in the marketplace. more details | more details | |
Boolean | Indicates whether an organization can list pre-provisioned items in the marketplace. more details | more details | |
Boolean | Indicates whether an organization can provision direct purchases in the marketplace without customer request. more details | more details | |
Boolean | When | more details | |
Boolean | The Bing key can be shared to the public and is returned as part of a portal's description call ( | more details | |
Boolean | When | more details | |
Boolean | Indicates whether to allow an organization with an enterprise IDP configured to be able to turn on or off the ArcGIS sign in. more details | more details | |
Boolean | Indicates whether to allow an organization with an enterprise IDP configured to be able to turn on or off the enterprise sign in. more details | more details | |
String | The query that identifies the group containing the color sets used for rendering in the map viewer. more details | more details | |
Boolean | Indicates whether to allow the organization to disable commenting. more details | more details | |
Date | Date the organization was created. more details | more details | |
String | The default locale (language and country) information. more details | more details | |
String | The custom base URL for the portal. more details | more details | |
String | The name of the class. more details | more details | |
Basemap | The default basemap to use for the portal. more details | more details | |
Extent | The default extent to use for the portal. more details | more details | |
Basemap | The default vector basemap to use for the portal. more details | more details | |
String | A description of the organization/portal. more details | more details | |
Object[] | Document this property? It does not show up. more details | more details | |
String | The query that defines the featured group. more details | more details | |
String | The query that identifies the group containing features items for the gallery. more details | more details | |
Object | Helper services provided by the portal. more details | more details | |
String | The group that contains featured content to be displayed on the home page. more details | more details | |
Number | The number of featured items that can be displayed on the home page. more details | more details | |
Number | The port used by the portal for HTTP communication. more details | more details | |
Number | The port used by the portal for HTTPS communication. more details | more details | |
String | The id of the organization that owns this portal. more details | more details | |
String | The country code of the calling IP (ArcGIS Online only). more details | more details | |
Boolean | Indicates whether the portal is an organization. more details | more details | |
Boolean | Indicates if the portal is on-premises. more details | more details | |
String | The query that identifies the group containing editing templates. more details | more details | |
Boolean | Indicates whether the portal's resources have loaded. more details | more details | |
Error | The Error object returned if an error occurred while loading. more details | more details | |
String | Represents the status of a load operation. more details | more details | |
Object[] | A list of warnings which occurred while loading. more details | more details | |
Number | The maximum validity in minutes of tokens issued for users of the organization. more details | more details | |
Date | Date the organization was last modified. more details | more details | |
String | Name of the organization. more details | more details | |
String | URL of the portal host. more details | more details | |
String | The portal mode. more details | more details | |
Object | Properties specific to the organization, for example the "contact us" link. more details | more details | |
String | The region for the organization. more details | more details | |
String | The REST URL for the portal, for example "https://www.arcgis.com/sharing/rest" for ArcGIS Online and "https://www.example.com/arcgis/sharing/rest" for your in-house portal. more details | more details | |
Object[] | Custom HTML for the home page. more details | more details | |
Boolean | Indicates whether the description of your organization displays on the home page. more details | more details | |
Boolean | Indicates whether hosted services are supported. more details | more details | |
String | The query that defines the symbols sets. more details | more details | |
String | The query that defines the collection of templates that will appear in the template gallery. more details | more details | |
String | The URL to the thumbnail of the organization. more details | more details | |
String | Sets the units of measure for the organization's users. more details | more details | |
String | The URL to the portal instance. more details | more details | |
String | The prefix selected by the organization's administrator to be used with the customBaseURL. more details | more details | |
PortalUser | Information representing a registered user of the portal. more details | more details | |
Boolean | When | more details | |
Boolean | When | more details | |
String | The query that defines the vector tiles basemaps that should be displayed in the BasemapGallery when useVectorBasemaps is true. more details | more details |
Property Details
accessString
The access level of the organization. When public, anonymous users can access the organization. When private, access is restricted to only members of the organization.
Known Values: public | private
allSSLBoolean
When
true
, access to the organization's Portal resources must occur over SSL.authModeString
The authentication mode for handling authentication when the user attempts to access a secure resource.
Possible Value Description anonymous An error will be returned when a secure resource is requested. auto The user will be signed in when a secure resource is requested. immediate The user will be signed in when the Portal is loaded. Default Value: autoauthorizedCrossOriginDomainsString[]
Array of trusted servers to send credentials to when making Cross-Origin Resource Sharing (CORS) requests to access services secured with web-tier authentication.
basemapGalleryGroupQueryString
Since: ArcGIS API for JavaScript 4.4The query that defines the basemaps that should be displayed in the BasemapGallery when useVectorBasemaps is not true. The fetchBasemaps() method does this automatically.
bingKeyString
The Bing key to use for web maps using Bing Maps.
canListAppsBoolean
Indicates whether an organization can list applications in the marketplace .
canListDataBoolean
Indicates whether an organization can list data services in the marketplace.
canListPreProvisionedItemsBoolean
Indicates whether an organization can list pre-provisioned items in the marketplace.
canProvisionDirectPurchaseBoolean
Indicates whether an organization can provision direct purchases in the marketplace without customer request.
canSearchPublicBoolean
When
true
, the organization's public items, groups and users are included in search queries. Whenfalse
, no public items outside of the organization are included. However, public items which are part of the organization are included.canShareBingPublicBoolean
The Bing key can be shared to the public and is returned as part of a portal's description call (
/sharing/rest/portals/<orgid>
). This requires the access of the portal to be set to public. The canShareBingPublic property is not returned publicly but only shown to users within the organization.Default Value: falsecanSharePublicBoolean
When
true
, members of the organization can share resources outside the organization.Default Value: falsecanSignInArcGISBoolean
Indicates whether to allow an organization with an enterprise IDP configured to be able to turn on or off the ArcGIS sign in.
Default Value: falsecanSignInIDPBoolean
Indicates whether to allow an organization with an enterprise IDP configured to be able to turn on or off the enterprise sign in.
Default Value: falsecolorSetsGroupQueryString
The query that identifies the group containing the color sets used for rendering in the map viewer.
commentsEnabledBoolean
Indicates whether to allow the organization to disable commenting. When commentsEnabled is false, comments are hidden and not removed. numComments are set to zero for all items in the organization. Calls to add a comment and view comments will fail. If the organization re-enables comments, the comments display and numComments are restored.
Default Value: falsecreatedDate
Date the organization was created.
cultureString
The default locale (language and country) information.
customBaseUrlString
The custom base URL for the portal.
declaredClassStringreadonly
The name of the class. The declared class name is formatted as
esri.folder.className
.defaultBasemapBasemap
The default basemap to use for the portal. Used in the map viewer.
defaultExtentExtent
The default extent to use for the portal. Used in the map viewer. The extent will be in the default basemap's spatial reference.
defaultVectorBasemapBasemap
Since: ArcGIS API for JavaScript 4.4The default vector basemap to use for the portal. Used in the map viewer.
descriptionString
A description of the organization/portal.
featuredGroupsObject[]
Document this property? It does not show up.
The featured groups for the portal. Returns an array of objects that provide access to the owner and title for each featured group. Each item in this array has the following specification:
featuredItemsGroupQueryString
The query that defines the featured group. If null, then the most viewed items in the organization will be the featured items.
galleryTemplatesGroupQueryString
The query that identifies the group containing features items for the gallery. Set a Group ID or, if null, then the most viewed items in your organization are displayed in the gallery.
helperServicesObject
Since: ArcGIS API for JavaScript 4.4Helper services provided by the portal. For the detailed information about these services, see the about utility services topic from the ArcGIS Server documentation.
homePageFeaturedContentString
The group that contains featured content to be displayed on the home page.
homePageFeaturedContentCountNumber
The number of featured items that can be displayed on the home page. The max is 100. Accepts integers only.
httpPortNumber
The port used by the portal for HTTP communication.
httpsPortNumber
The port used by the portal for HTTPS communication.
idString
The id of the organization that owns this portal. If
null
then this is the default portal for anonymous and non-organizational users.ipCntryCodeString
The country code of the calling IP (ArcGIS Online only).
isOrganizationBooleanreadonly
Indicates whether the portal is an organization.
isPortalBoolean
Indicates if the portal is on-premises.
layerTemplatesGroupQueryString
The query that identifies the group containing editing templates.
loadedBooleanreadonly
Indicates whether the portal's resources have loaded. When
true
, all the properties of the object can be accessed.Default Value: falseloadErrorErrorreadonly
The Error object returned if an error occurred while loading.
Default Value: nullloadStatusStringreadonly
Represents the status of a load operation.
Value Description not-loaded The object's resources have not loaded. loading The object's resources are currently loading. loaded The object's resources have loaded without errors. failed The object's resources failed to load. See loadError for more details. Default Value: not-loadedloadWarningsObject[]readonly
A list of warnings which occurred while loading.
maxTokenExpirationMinutesNumber
The maximum validity in minutes of tokens issued for users of the organization. -1 is the default and is a special value that indicates infinite timeout or permanent tokens. For tokens granted using OAuth 2.0 authorization grant, it represents the maximum validity of refresh tokens. For access tokens, the maximum validity is the lower of two weeks or this value.
modifiedDate
Date the organization was last modified.
nameString
Name of the organization.
portalHostnameString
URL of the portal host.
portalModeString
The portal mode.
Known Values: multitenant | singletenant
portalPropertiesObject
Properties specific to the organization, for example the "contact us" link. If the organization is public, the properties are visible to the anonymous user.
regionString
The region for the organization.
restUrlStringreadonly
The REST URL for the portal, for example "https://www.arcgis.com/sharing/rest" for ArcGIS Online and "https://www.example.com/arcgis/sharing/rest" for your in-house portal.
rotatorPanelsObject[]
Custom HTML for the home page.
showHomePageDescriptionBoolean
Indicates whether the description of your organization displays on the home page.
supportsHostedServicesBoolean
Indicates whether hosted services are supported.
Default Value: falsesymbolSetsGroupQueryString
The query that defines the symbols sets.
templatesGroupQueryString
The query that defines the collection of templates that will appear in the template gallery.
thumbnailUrlStringreadonly
The URL to the thumbnail of the organization.
unitsString
Sets the units of measure for the organization's users. The user default is derived from the organization's region. Set units to english for US standards or metric.
urlString
The URL to the portal instance. Setting the location of the portal instance via esriConfig.portalUrl should be used in favor of setting it directly on this property.
If using an on-premise portal, the syntax should look similar to:
https://www.example.com/arcgis
Default Value: esriConfig.portalUrlurlKeyString
The prefix selected by the organization's administrator to be used with the customBaseURL.
userPortalUser
Information representing a registered user of the portal.
useStandardizedQueryBoolean
When
true
, only simple where clauses that are compliant with SQL92 can be used when querying layers and tables. The recommended security setting is true.useVectorBasemapsBoolean
Since: ArcGIS API for JavaScript 4.4When
true
, the organization has opted in to use the vector tile basemaps, and (a) vectorBasemapGalleryGroupQuery should be used instead of basemapGalleryGroupQuery, while (b) defaultVectorBasemap should be used instead of defaultBasemap. The fetchBasemaps() method automatically uses vectorBasemapGalleryGroupQuery.vectorBasemapGalleryGroupQueryString
Since: ArcGIS API for JavaScript 4.4The query that defines the vector tiles basemaps that should be displayed in the BasemapGallery when useVectorBasemaps is true. The fetchBasemaps() method does this automatically.
Method Overview
Name | Return Type | Summary | |
---|---|---|---|
Promise | An instance of this class is a Promise. more details | more details | |
Cancels a load() operation if it is already in progress. more details | more details | ||
Promise | Fetches the basemaps that are displayed in the BasemapGallery. more details | more details | |
Promise | Fetches the featured groups in the Portal. more details | more details | |
Portal | Returns a cached default Portal instance. more details | more details | |
Boolean | An instance of this class is a Promise. more details | more details | |
Boolean | An instance of this class is a Promise. more details | more details | |
Boolean | An instance of this class is a Promise. more details | more details | |
Promise | Loads the resources referenced by this class. more details | more details | |
Promise | An instance of this class is a Promise. more details | more details | |
Promise | Executes a query against the Portal to return an array of PortalGroup objects that match the input query. more details | more details | |
Promise | Executes a query against the Portal to return an array of PortalItem objects that match the input query. more details | more details | |
Promise | Executes a query against the Portal to return an array of PortalUser objects that match the input query. more details | more details | |
Promise | An instance of this class is a Promise. more details | more details |
Method Details
always(callbackOrErrback){Promise}
An instance of this class is a Promise. Therefore
always()
may be used to execute a function if the promise is rejected or resolved. The input function will always execute no matter the response. For more information about promises, see the Working with Promises guide page.Parameter:optionalcallbackOrErrback FunctionThe function to execute when the promise is rejected or resolved.
Returns:Type Description Promise Returns a new promise for the result of callbackOrErrback
.Example:// Although this example uses MapView, any class instance that is a promise may use always() in the same way var view = new MapView(); view.always(function(){ // This function will always execute whether or not the promise is resolved or rejected });
cancelLoad()
Cancels a load() operation if it is already in progress.
fetchBasemaps(){Promise}
Fetches the basemaps that are displayed in the BasemapGallery. When useVectorBasemaps is
true
, the basemaps will be based on vectorBasemapGalleryGroupQuery, and otherwise on basemapGalleryGroupQuery.Returns:Type Description Promise Resolves to an array of Basemap objects representing the basemaps used in the Basemap Gallery of the Portal. fetchFeaturedGroups(){Promise}
Fetches the featured groups in the Portal.
Returns:Type Description Promise Resolves to an array of PortalGroup objects. Example:// fetch featured groups portal.fetchFeaturedGroups().then(function(groups){ groups.forEach(function(group){ group.fetchMembers().then(function(members){ console.log("member", members); }); }); });
getDefault(){Portal}static
Returns a cached default Portal instance.
Returns:Type Description Portal isFulfilled(){Boolean}
An instance of this class is a Promise. Therefore
isFulfilled()
may be used to verify if the promise is fulfilled (either resolved or rejected). If it is fulfilled,true
will be returned. See the Working with Promises guide page for more information about promises.Returns:Type Description Boolean Indicates whether the promise has been fulfilled (either resolved or rejected). isRejected(){Boolean}
An instance of this class is a Promise. Therefore
isRejected()
may be used to verify if the promise is rejected. If it is rejected,true
will be returned. See the Working with Promises guide page for more information about promises.Returns:Type Description Boolean Indicates whether the promise has been rejected. isResolved(){Boolean}
An instance of this class is a Promise. Therefore
isResolved()
may be used to verify if the promise is resolved. If it is resolved,true
will be returned. See the Working with Promises guide page for more information about promises.Returns:Type Description Boolean Indicates whether the promise has been resolved. load(){Promise}
Loads the resources referenced by this class. This method automatically executes for a View and all of the resources it references in Map if the view is constructed with a map instance.
This method must be called by the developer when accessing a resource that will not be loaded in a View.
Returns:Type Description Promise Resolves when the resources have loaded. otherwise(errback){Promise}
An instance of this class is a Promise. Use
otherwise()
to call a function once the promise is rejected.Parameter:optionalerrback FunctionThe function to execute when the promise fails.
Returns:Type Description Promise Returns a new promise for the result of errback
.Example:// Although this example uses MapView, any class instance that is a promise may use otherwise() in the same way var view = new MapView(); view.otherwise(function(error){ // This function will execute if the promise is rejected due to an error });
queryGroups(queryParams){Promise}
Executes a query against the Portal to return an array of PortalGroup objects that match the input query.
Parameter:queryParams PortalQueryParamsThe input query parameters defined in PortalQueryParams. This object may be autocast.
Returns:Type Description Promise When resolved, resolves to an instance of PortalQueryResult which contains a results
array of PortalGroup objects representing all the groups that match the input query.- See also:
queryItems(queryParams){Promise}
Executes a query against the Portal to return an array of PortalItem objects that match the input query.
Parameter:queryParams PortalQueryParamsThe input query parameters defined in PortalQueryParams. This object may be autocast.
Returns:Type Description Promise When resolved, resolves to an instance of PortalQueryResult which contains a results
array of PortalItem objects representing all the items that match the input query.- See also:
Example:// Once portal is loaded, user signed in portal.load().then(function() { console.log(portal); // Create query parameters for the portal search // This object autocasts as esri/portal/PortalQueryParams var queryParams = { query: "owner:" + portal.user.username, sortField: "numViews", sortOrder: "desc", num: 20 }; // Query the items based on the queryParams created from portal above portal.queryItems(queryParams).then(createGallery); });
queryUsers(queryParams){Promise}
Executes a query against the Portal to return an array of PortalUser objects that match the input query.
Parameter:queryParams PortalQueryParamsThe input query parameters defined in PortalQueryParams. This object may be autocast.
Returns:Type Description Promise When resolved, resolves to an instance of PortalQueryResult which contains a results
array of PortalUser objects representing all the items that match the input query.- See also:
Example:// Once portal is loaded, user signed in portal.load().then(function() { // queryUsers // This object autocasts as esri/portal/PortalQueryParams var queryParameters = { query: "username:" + portal.user.username }; portal.queryUsers(queryParameters).then(function(queryResults){ queryResults.results[0].fetchFolders().then(function(folders){ folders.forEach(function(folder){ console.log(" user folder", folder.title); }); }); }); });
then(callback, errback, progback){Promise}
An instance of this class is a Promise. Therefore
then()
may be leveraged once an instance of the class is created. This method takes two input parameters: acallback
function and anerrback
function. Thecallback
executes when the promise resolves (when the instance of the class loads). Theerrback
executes if the promise fails. See the Working with Promises guide page for additional details.Parameters:optionalcallback FunctionThe function to call when the promise resolves.
optionalerrback FunctionThe function to execute when the promise fails.
optionalprogback FunctionThe function to invoke when the promise emits a progress update.
Returns:Type Description Promise Returns a new promise for the result of callback
that may be used to chain additional functions.Example:// Although this example uses MapView, any class instance that is a promise may use then() in the same way var view = new MapView(); view.then(function(){ // This function will execute once the promise is resolved }, function(error){ // This function will execute if the promise is rejected due to an error });