Portal

AMD: require(["esri/portal/Portal"], (Portal) => { /* code goes here */ });
ESM: import Portal from "@arcgis/core/portal/Portal.js";
Class: esri/portal/Portal
Inheritance: PortalAccessor
Since: ArcGIS Maps SDK for JavaScript 4.0

The Portal class is part of the ArcGIS Enterprise portal that provides a way to build applications that work with content from ArcGIS Online or an ArcGIS Enterprise portal. ArcGIS Enterprise 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 Enterprise.

The Portal API allows application developers to work with users, groups and content hosted within ArcGIS Online or within an ArcGIS Enterprise 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. It 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 that is obtained from the users profile.

If no url is set before loading the Portal, the API defaults to that of esriConfig.portalUrl. There may be scenarios when more than one portal instance are needed. In these circumstances, there are a couple of different options to take into account.

  1. Set a new Portal instance within the PortalItem and set the portal's url.
    Layer.fromPortalItem({
      portalItem: {
        id: "e691172598f04ea8881cd2a4adaa45ba",
        // autocastable to Portal
        portal: {
          url: "https://thePortalUrl"
        }
      }
    });
    
  2. Create separate portal instances before passing them into the PortalItem's portal property.
    let portalA = new Portal({
      url: "https://www.exampleA.com/arcgis" // First instance
    });
    
    let portalB = new Portal({
      url: "https://www.exampleB.com/arcgis" // Second instance
    });
    
    let item = new PortalItem({
      id: "e691172598f04ea8881cd2a4adaa45ba",
      portal: portalA // This loads the first portal instance set above
    });
    
    item.load();
    

The when() method on the Portal instance can be called 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"
], 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 new PortalQueryParams()
    let 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);
  });
});
See also

Constructors

Portal

Constructor
new Portal(properties)
Parameter
properties Object
optional

See the properties for a list of all the properties that may be passed into the constructor.

Property Overview

Any properties can be set, retrieved or listened to. See the Watch for changes topic.
Show inherited properties Hide inherited properties
Name Type Summary Class

The access level of the organization.

Portal

When true, access to the organization's Portal resources must occur over SSL.

Portal

The authentication mode for handling authentication when the user attempts to access a secure resource.

Portal

Array of trusted servers to send credentials to when making Cross-Origin Resource Sharing (CORS) requests to access services secured with web-tier authentication.

Portal

The query that defines the basemaps that should be displayed in the BasemapGallery when useVectorBasemaps is not true.

Portal

The query that defines the 3D basemaps that should be displayed in the BasemapGallery.

Portal

The Bing key to use for web maps using Bing Maps.

Portal

Indicates whether an organization can list applications in the marketplace.

Portal

Indicates whether an organization can list data services in the marketplace.

Portal

Indicates whether an organization can list pre-provisioned items in the marketplace.

Portal

Indicates whether an organization can provision direct purchases in the marketplace without customer request.

Portal

When true, the organization's public items, groups and users are included in search queries.

Portal

The Bing key can be shared to the public and is returned as part of a portal's description call (/sharing/rest/portals/<orgid>).

Portal

When true, members of the organization can share resources outside the organization.

Portal

Indicates whether to allow an organization with an enterprise IDP configured to be able to turn on or off the ArcGIS sign in.

Portal

Indicates whether to allow an organization with an enterprise IDP configured to be able to turn on or off the enterprise sign in.

Portal

The query that identifies the group containing the color sets used for rendering in the map viewer.

Portal

Indicates whether to allow the organization to disable commenting.

Portal

Date the organization was created.

Portal

The default locale (language and country) information.

Portal

The custom base URL for the portal.

Portal

The name of the class.

Accessor

The query that defines the default 3d basemap to use in scene views for the portal.

Portal

The default basemap to use for the portal.

Portal

The default developer basemap to use for the portal when an apiKey is defined.

Portal

The default extent to use for the portal.

Portal

The default vector basemap to use for the portal.

Portal

A description of the organization/portal.

Portal

The query that defines the basemaps that should be displayed in the BasemapGallery when an apiKey is defined.

Portal

Boolean value indicating whether to opt-in to the Esri User Experience Improvement (EUEI) program.

Portal

The featured groups for the portal.

Portal

The query that defines the featured group.

Portal

The query that identifies the group containing features items for the gallery.

Portal

Indicates whether the organization has content categories.

Portal

Indicates whether the organization has classification schema.

Portal

This class contains properties to obtain information for various web services available on the portal.

Portal

The group that contains featured content to be displayed on the home page.

Portal

The number of featured items that can be displayed on the home page.

Portal

The port used by the portal for HTTP communication.

Portal

The port used by the portal for HTTPS communication.

Portal

The id of the organization that owns this portal.

Portal

The country code of the calling IP (ArcGIS Online only).

Portal

Indicates whether the portal is an organization.

Portal

Indicates if the portal is on-premises.

Portal

Indicates if the portal is in read-only mode.

Portal

The query that identifies the group containing editing templates.

Portal

The Error object returned if an error occurred while loading.

Portal

Represents the status of a load operation.

Portal

A list of warnings which occurred while loading.

Portal

Indicates whether the portal's resources have loaded.

Portal

The maximum validity in minutes of tokens issued for users of the organization.

Portal

Date the organization was last modified.

Portal

Name of the organization.

Portal

URL of the portal host.

Portal

The portal mode.

Portal

Properties specific to the organization, for example the "contact us" link.

Portal

Indicates whether the recycle bin is enabled for the organization.

Portal

The region for the organization.

Portal

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.

Portal

Custom HTML for the home page.

Portal

Indicates whether the description of your organization displays on the home page.

Portal

The JSON used to create the property values when the Portal is loaded.

Portal

Indicates whether hosted services are supported.

Portal

The query that defines the symbols sets.

Portal

The query that defines the collection of templates that will appear in the template gallery.

Portal

The URL to the thumbnail of the organization.

Portal

Sets the units of measure for the organization's users.

Portal

The URL to the portal instance.

Portal

The prefix selected by the organization's administrator to be used with the customBaseURL.

Portal

When false, 3D basemaps are hidden from the BasemapGallery, regardless of the type of the view.

Portal

When false, The default 3d basemap is not used in the SceneViewer.

Portal

When true, only simple where clauses that are compliant with SQL92 can be used when querying layers and tables.

Portal

When 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.

Portal

Information representing a registered user of the portal.

Portal

The query that defines the vector tiles basemaps that should be displayed in the BasemapGallery when useVectorBasemaps is true.

Portal

Property Details

access

Property
access String

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.

Possible Values:"public" |"private"

allSSL

Property
allSSL Boolean

When true, access to the organization's Portal resources must occur over SSL.

authMode

Property
authMode String

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.
no-prompt Checks for whether the user is already signed in. If so, no additional prompts display for sign-in.

Possible Values:"anonymous" |"auto" |"immediate" |"no-prompt"

Default Value:"auto"

authorizedCrossOriginDomains

Property
authorizedCrossOriginDomains 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.

basemapGalleryGroupQuery

Property
basemapGalleryGroupQuery String
Since: ArcGIS Maps SDK for JavaScript 4.4 Portal since 4.0, basemapGalleryGroupQuery added at 4.4.

The query that defines the basemaps that should be displayed in the BasemapGallery when useVectorBasemaps is not true. The fetchBasemaps() method does this automatically.

basemapGalleryGroupQuery3D

Property
basemapGalleryGroupQuery3D String
Since: ArcGIS Maps SDK for JavaScript 4.27 Portal since 4.0, basemapGalleryGroupQuery3D added at 4.27.

The query that defines the 3D basemaps that should be displayed in the BasemapGallery. The fetchBasemaps() method does this automatically.

bingKey

Property
bingKey String

The Bing key to use for web maps using Bing Maps.

canListApps

Property
canListApps Boolean

Indicates whether an organization can list applications in the marketplace.

canListData

Property
canListData Boolean

Indicates whether an organization can list data services in the marketplace.

canListPreProvisionedItems

Property
canListPreProvisionedItems Boolean

Indicates whether an organization can list pre-provisioned items in the marketplace.

canProvisionDirectPurchase

Property
canProvisionDirectPurchase Boolean

Indicates whether an organization can provision direct purchases in the marketplace without customer request.

canSearchPublic

Property
canSearchPublic Boolean

When true, the organization's public items, groups and users are included in search queries. When false, no public items outside of the organization are included. However, public items which are part of the organization are included.

Default Value:true

canShareBingPublic

Property
canShareBingPublic Boolean

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:false

canSharePublic

Property
canSharePublic Boolean

When true, members of the organization can share resources outside the organization.

Default Value:false

canSignInArcGIS

Property
canSignInArcGIS Boolean

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:false

canSignInIDP

Property
canSignInIDP Boolean

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:false

colorSetsGroupQuery

Property
colorSetsGroupQuery String

The query that identifies the group containing the color sets used for rendering in the map viewer.

commentsEnabled

Property
commentsEnabled Boolean

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:false

created

Property
created Date

Date the organization was created.

culture

Property
culture String

The default locale (language and country) information.

customBaseUrl

Property
customBaseUrl String

The custom base URL for the portal.

declaredClass

Inherited
Property
declaredClass Stringreadonly
Inherited from Accessor
Since: ArcGIS Maps SDK for JavaScript 4.7 Accessor since 4.0, declaredClass added at 4.7.

The name of the class. The declared class name is formatted as esri.folder.className.

default3DBasemapQuery

Property
default3DBasemapQuery String
Since: ArcGIS Maps SDK for JavaScript 4.31 Portal since 4.0, default3DBasemapQuery added at 4.31.

The query that defines the default 3d basemap to use in scene views for the portal. The fetchDefault3DBasemap() method uses this to return a basemap object.

defaultBasemap

Property
defaultBasemap Basemap

The default basemap to use for the portal. Used in the map viewer.

defaultDevBasemap

Property
defaultDevBasemap Basemap
Since: ArcGIS Maps SDK for JavaScript 4.22 Portal since 4.0, defaultDevBasemap added at 4.22.

The default developer basemap to use for the portal when an apiKey is defined.

defaultExtent

Property
defaultExtent Extent

The default extent to use for the portal. Used in the map viewer. The extent will be in the default basemap's spatial reference.

defaultVectorBasemap

Property
defaultVectorBasemap Basemap
Since: ArcGIS Maps SDK for JavaScript 4.4 Portal since 4.0, defaultVectorBasemap added at 4.4.

The default vector basemap to use for the portal. Used in the map viewer.

description

Property
description String

A description of the organization/portal.

devBasemapGalleryGroupQuery

Property
devBasemapGalleryGroupQuery String
Since: ArcGIS Maps SDK for JavaScript 4.22 Portal since 4.0, devBasemapGalleryGroupQuery added at 4.22.

The query that defines the basemaps that should be displayed in the BasemapGallery when an apiKey is defined. The fetchBasemaps() method does this automatically.

eueiEnabled

Property
eueiEnabled Boolean
Since: ArcGIS Maps SDK for JavaScript 4.7 Portal since 4.0, eueiEnabled added at 4.7.

Boolean value indicating whether to opt-in to the Esri User Experience Improvement (EUEI) program.

Default Value:null

featuredGroups

Property
featuredGroups Object[]

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:

Properties
owner String

Name of the group owner.

title String

Group title.

featuredItemsGroupQuery

Property
featuredItemsGroupQuery String

The query that defines the featured group. If null, then the most viewed items in the organization will be the featured items.

galleryTemplatesGroupQuery

Property
galleryTemplatesGroupQuery String

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.

hasCategorySchema

Property
hasCategorySchema Boolean
Since: ArcGIS Maps SDK for JavaScript 4.8 Portal since 4.0, hasCategorySchema added at 4.8.

Indicates whether the organization has content categories.

Default Value:false

hasClassificationSchema

Property
hasClassificationSchema Boolean
Since: ArcGIS Maps SDK for JavaScript 4.31 Portal since 4.0, hasClassificationSchema added at 4.31.

Indicates whether the organization has classification schema.

Default Value:false

helperServices

Property
helperServices Object
Since: ArcGIS Maps SDK for JavaScript 4.4 Portal since 4.0, helperServices added at 4.4.

This class contains properties to obtain information for various web services available on the portal. This is useful for determining the URLs for relevant methods from the portal.helperServices object. The url property of each helper service is the URL to the REST endpoint for that service.

It is recommended to use these URLs with their respective rest modules instead of the deprecated helper methods. For additional information about helper services, see the about utility services topic from the ArcGIS Server documentation.

Example
// create new Portal object with relevant URL
const portal = new Portal({
  url: "YOUR_PORTAL_URL"
});

// load Portal instance
portal.load().then(function() {
  // display all helper services
  console.log("Show available helperServices: ", portal.helperServices);
  // access helperServices from the Portal instance
  // to get the routing URL of interest
  const routeURL = portal.helperServices.route.url;
  // use helperServices to perform routing
  route.solve(routeURL, routeParams).then(showRouteInfo);
}

homePageFeaturedContent

Property
homePageFeaturedContent String

The group that contains featured content to be displayed on the home page.

homePageFeaturedContentCount

Property
homePageFeaturedContentCount Number

The number of featured items that can be displayed on the home page. The max is 100. Accepts integers only.

httpPort

Property
httpPort Number

The port used by the portal for HTTP communication.

httpsPort

Property
httpsPort Number

The port used by the portal for HTTPS communication.

id

Property
id String

The id of the organization that owns this portal. If null then this is the default portal for anonymous and non-organizational users.

ipCntryCode

Property
ipCntryCode String

The country code of the calling IP (ArcGIS Online only).

isOrganization

Property
isOrganization Booleanreadonly

Indicates whether the portal is an organization.

isPortal

Property
isPortal Boolean

Indicates if the portal is on-premises.

isReadOnly

Property
isReadOnly Boolean
Since: ArcGIS Maps SDK for JavaScript 4.14 Portal since 4.0, isReadOnly added at 4.14.

Indicates if the portal is in read-only mode. When true, content cannot be created, modified, or deleted on the Portal.

layerTemplatesGroupQuery

Property
layerTemplatesGroupQuery String

The query that identifies the group containing editing templates.

loadError

Property
loadError Errorreadonly

The Error object returned if an error occurred while loading.

Default Value:null

loadStatus

Property
loadStatus Stringreadonly

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.

Possible Values:"not-loaded" |"loading" |"failed" |"loaded"

Default Value:"not-loaded"

loadWarnings

Property
loadWarnings Object[]readonly

A list of warnings which occurred while loading.

loaded

Property
loaded Booleanreadonly

Indicates whether the portal's resources have loaded. When true, all the properties of the object can be accessed.

Default Value:false

maxTokenExpirationMinutes

Property
maxTokenExpirationMinutes Number

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.

modified

Property
modified Date

Date the organization was last modified.

name

Property
name String

Name of the organization.

portalHostname

Property
portalHostname String

URL of the portal host.

portalMode

Property
portalMode String

The portal mode.

Possible Values:"multitenant" |"singletenant"

portalProperties

Property
portalProperties Object

Properties specific to the organization, for example the "contact us" link. If the organization is public, the properties are visible to the anonymous user.

recycleBinEnabled

Property
recycleBinEnabled Boolean
Since: ArcGIS Maps SDK for JavaScript 4.30 Portal since 4.0, recycleBinEnabled added at 4.30.

Indicates whether the recycle bin is enabled for the organization.

region

Property
region String

The region for the organization.

restUrl

Property
restUrl Stringreadonly

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.

rotatorPanels

Property
rotatorPanels Object[]

Custom HTML for the home page.

showHomePageDescription

Property
showHomePageDescription Boolean

Indicates whether the description of your organization displays on the home page.

sourceJSON

Property
sourceJSON Object
Since: ArcGIS Maps SDK for JavaScript 4.13 Portal since 4.0, sourceJSON added at 4.13.

The JSON used to create the property values when the Portal is loaded. Although most commonly used properties are exposed on the Portal class directly, this provides access to all information returned by the portal. This property is useful if working in an application built using an older version of the API which requires access to portal properties from a more recent version.

supportsHostedServices

Property
supportsHostedServices Boolean

Indicates whether hosted services are supported.

Default Value:false

symbolSetsGroupQuery

Property
symbolSetsGroupQuery String

The query that defines the symbols sets.

templatesGroupQuery

Property
templatesGroupQuery String

The query that defines the collection of templates that will appear in the template gallery.

thumbnailUrl

Property
thumbnailUrl Stringreadonly

The URL to the thumbnail of the organization.

units

Property
units String

Sets the units of measure for the organization's users. The user default is derived from the organization's region.

Possible Values:"english" |"metric"

url

Property
url String

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: The default value for this property is the same as the esriConfig.portalUrl property value.

urlKey

Property
urlKey String

The prefix selected by the organization's administrator to be used with the customBaseURL.

use3dBasemaps

Property
use3dBasemaps Boolean
Since: ArcGIS Maps SDK for JavaScript 4.27 Portal since 4.0, use3dBasemaps added at 4.27.

When false, 3D basemaps are hidden from the BasemapGallery, regardless of the type of the view.

useDefault3dBasemap

Property
useDefault3dBasemap Boolean
Since: ArcGIS Maps SDK for JavaScript 4.31 Portal since 4.0, useDefault3dBasemap added at 4.31.

When false, The default 3d basemap is not used in the SceneViewer.

useStandardizedQuery

Property
useStandardizedQuery Boolean

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.

useVectorBasemaps

Property
useVectorBasemaps Boolean
Since: ArcGIS Maps SDK for JavaScript 4.4 Portal since 4.0, useVectorBasemaps added at 4.4.

When 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.

user

Property
user PortalUser

Information representing a registered user of the portal.

vectorBasemapGalleryGroupQuery

Property
vectorBasemapGalleryGroupQuery String
Since: ArcGIS Maps SDK for JavaScript 4.4 Portal since 4.0, vectorBasemapGalleryGroupQuery added at 4.4.

The 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

Show inherited methods Hide inherited methods
Name Return Type Summary Class

Adds one or more handles which are to be tied to the lifecycle of the object.

Accessor

Cancels a load() operation if it is already in progress.

Portal

A helper function that returns an array of ElevationsLayers derived from the Portal's Limited Error Raster Compression (LERC) elevation helper service.

Portal
Promise<Basemap[]>

Fetches the basemaps that are displayed in the BasemapGallery.

Portal
Promise<Object[]>

If present, fetches the organization's category schema.

Portal
Promise<Basemap>

Fetches the default 3d Basemap to use in SceneView for this portal.

Portal
Promise<PortalGroup[]>

Fetches the featured groups in the Portal.

Portal
Promise<Object[]>

Fetches and returns the associated regions with the portal instance.

Portal
Promise<Object>

Fetches and returns the portal settings as seen by the current user(s), whether anonymous or signed in.

Portal

A new Portal instance is created the first time this method is called.

Portal

Returns true if a named group of handles exist.

Accessor

isFulfilled() may be used to verify if creating an instance of the class is fulfilled (either resolved or rejected).

Portal

isRejected() may be used to verify if creating an instance of the class is rejected.

Portal

isResolved() may be used to verify if creating an instance of the class is resolved.

Portal
Promise

Loads the resources referenced by this class.

Portal

Executes a query against the Portal to return an array of PortalGroup objects that match the input query.

Portal

Executes a query against the Portal to return an array of PortalItem objects that match the input query.

Portal

Executes a query against the Portal to return an array of PortalUser objects that match the input query.

Portal

Removes a group of handles owned by the object.

Accessor
Promise

when() may be leveraged once an instance of the class is created.

Portal

Method Details

addHandles

Inherited
Method
addHandles(handleOrHandles, groupKey)
Inherited from Accessor
Since: ArcGIS Maps SDK for JavaScript 4.25 Accessor since 4.0, addHandles added at 4.25.

Adds one or more handles which are to be tied to the lifecycle of the object. The handles will be removed when the object is destroyed.

// Manually manage handles
const handle = reactiveUtils.when(
  () => !view.updating,
  () => {
    wkidSelect.disabled = false;
  },
  { once: true }
);

this.addHandles(handle);

// Destroy the object
this.destroy();
Parameters
handleOrHandles WatchHandle|WatchHandle[]

Handles marked for removal once the object is destroyed.

groupKey *
optional

Key identifying the group to which the handles should be added. All the handles in the group can later be removed with Accessor.removeHandles(). If no key is provided the handles are added to a default group.

cancelLoad

Method
cancelLoad()

Cancels a load() operation if it is already in progress.

createElevationLayers

Method
createElevationLayers(){Promise<ElevationLayer[]>}
Since: ArcGIS Maps SDK for JavaScript 4.12 Portal since 4.0, createElevationLayers added at 4.12.

A helper function that returns an array of ElevationsLayers derived from the Portal's Limited Error Raster Compression (LERC) elevation helper service.

Returns
Type Description
Promise<ElevationLayer[]> When resolved, returns an array of ElevationLayers.
See also

fetchBasemaps

Method
fetchBasemaps(basemapGalleryGroupQuery, options){Promise<Basemap[]>}

Fetches the basemaps that are displayed in the BasemapGallery. When an apiKey is defined, the basemaps will be based on devBasemapGalleryGroupQuery. When useVectorBasemaps is true, the basemaps will be based on vectorBasemapGalleryGroupQuery. Otherwise, it is based on basemapGalleryGroupQuery.

Parameters
Specification
basemapGalleryGroupQuery String
optional

When provided, this argument is used to fetch basemaps based on input query parameters.

options Object
optional

An object with the following properties.

Specification
signal AbortSignal
optional

Signal object that can be used to abort the asynchronous task. The returned promise will be rejected with an Error named AbortError when an abort is signaled. See also AbortController for more information on how to construct a controller that can be used to deliver abort signals.

include3d Boolean
optional

When true the basemaps based on basemapGalleryGroupQuery3D are also fetched, if no basemapGalleryGroupQuery is passed as an argument. When true and a custom basemapGalleryGroupQuery is passed, also 3D basemaps from the custom group are fetched. When not specified, it will default to use3dBasemaps.

Returns
Type Description
Promise<Basemap[]> Resolves to an array of Basemap objects representing the basemaps used in the Basemap Gallery of the Portal.
Example
portal.fetchBasemaps("title:\"Cloud Creek Basemaps\" AND owner:jsmith")
 .then(function(basemaps){
   // do something with the basemaps
 });

fetchCategorySchema

Method
fetchCategorySchema(options){Promise<Object[]>}
Since: ArcGIS Maps SDK for JavaScript 4.8 Portal since 4.0, fetchCategorySchema added at 4.8.

If present, fetches the organization's category schema.

Parameters
options Object
optional

An object with the following properties.

Specification
signal AbortSignal
optional

Signal object that can be used to abort the asynchronous task. The returned promise will be rejected with an Error named AbortError when an abort is signaled. See also AbortController for more information on how to construct a controller that can be used to deliver abort signals.

Returns
Type Description
Promise<Object[]> Resolves to an array of objects containing the following properties:
Property Type Description
title string The title of the category schema.
categories object[] An array of objects containing a title and an array of categories.
Example
// Fetches the category schema
portal.fetchCategorySchema().then(function(schemas){
  schemas.forEach(function(schema){
    console.log("schema: ", schema);
  });
});

fetchDefault3DBasemap

Method
fetchDefault3DBasemap(options){Promise<Basemap>}
Since: ArcGIS Maps SDK for JavaScript 4.31 Portal since 4.0, fetchDefault3DBasemap added at 4.31.

Fetches the default 3d Basemap to use in SceneView for this portal.

Parameters
options Object
optional

An object with the following properties.

Specification
signal AbortSignal
optional

Signal object that can be used to abort the asynchronous task. The returned promise will be rejected with an Error named AbortError when an abort is signaled. See also AbortController for more information on how to construct a controller that can be used to deliver abort signals.

Returns
Type Description
Promise<Basemap> Resolves to a Basemap object.

fetchFeaturedGroups

Method
fetchFeaturedGroups(options){Promise<PortalGroup[]>}

Fetches the featured groups in the Portal.

Parameters
options Object
optional

An object with the following properties.

Specification
signal AbortSignal
optional

Signal object that can be used to abort the asynchronous task. The returned promise will be rejected with an Error named AbortError when an abort is signaled. See also AbortController for more information on how to construct a controller that can be used to deliver abort signals.

Returns
Type Description
Promise<PortalGroup[]> 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);
     });
   });
});

fetchRegions

Method
fetchRegions(options){Promise<Object[]>}
Since: ArcGIS Maps SDK for JavaScript 4.8 Portal since 4.0, fetchRegions added at 4.8.

Fetches and returns the associated regions with the portal instance.

Parameters
options Object
optional

An object with the following properties.

Specification
signal AbortSignal
optional

Signal object that can be used to abort the asynchronous task. The returned promise will be rejected with an Error named AbortError when an abort is signaled. See also AbortController for more information on how to construct a controller that can be used to deliver abort signals.

Returns
Type Description
Promise<Object[]> Resolves to an array of objects containing the following properties:
Property Type Description
localizedName string The localized name for the region. For example, "Australia".
name string The name of the region. For example, "Australia".
region string Region name. For example, "AU".

fetchSettings

Method
fetchSettings(options){Promise<Object>}
Since: ArcGIS Maps SDK for JavaScript 4.23 Portal since 4.0, fetchSettings added at 4.23.

Fetches and returns the portal settings as seen by the current user(s), whether anonymous or signed in. This returns information such as any accessible helper services, allowed redirect URIs, and the configuration for any access notices or information banners.

Parameters
options Object
optional

An object with the following properties.

Specification
signal AbortSignal
optional

Signal object that can be used to abort the asynchronous task. The returned promise will be rejected with an Error named AbortError when an abort is signaled. See also AbortController for more information on how to construct a controller that can be used to deliver abort signals.

Returns
Type Description
Promise<Object> Resolves to an object containing information such as helper services, redirect URIs, and configurations for access notices or information banners.

getDefault

Method
getDefault(){Portal}static

A new Portal instance is created the first time this method is called. The URL from config.portalUrl is automatically used for this instance. This instance is then cached and used for any subsequent calls to this method.

Returns
Type Description
Portal The Portal instance.

hasHandles

Inherited
Method
hasHandles(groupKey){Boolean}
Inherited from Accessor
Since: ArcGIS Maps SDK for JavaScript 4.25 Accessor since 4.0, hasHandles added at 4.25.

Returns true if a named group of handles exist.

Parameter
groupKey *
optional

A group key.

Returns
Type Description
Boolean Returns true if a named group of handles exist.
Example
// Remove a named group of handles if they exist.
if (obj.hasHandles("watch-view-updates")) {
  obj.removeHandles("watch-view-updates");
}

isFulfilled

Method
isFulfilled(){Boolean}

isFulfilled() may be used to verify if creating an instance of the class is fulfilled (either resolved or rejected). If it is fulfilled, true will be returned.

Returns
Type Description
Boolean Indicates whether creating an instance of the class has been fulfilled (either resolved or rejected).

isRejected

Method
isRejected(){Boolean}

isRejected() may be used to verify if creating an instance of the class is rejected. If it is rejected, true will be returned.

Returns
Type Description
Boolean Indicates whether creating an instance of the class has been rejected.

isResolved

Method
isResolved(){Boolean}

isResolved() may be used to verify if creating an instance of the class is resolved. If it is resolved, true will be returned.

Returns
Type Description
Boolean Indicates whether creating an instance of the class has been resolved.

load

Method
load(signal){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.

The load() method only triggers the loading of the resource the first time it is called. The subsequent calls return the same promise.

It's possible to provide a signal to stop being interested into a Loadable instance load status. When the signal is aborted, the instance does not stop its loading process, only cancelLoad can abort it.

Parameter
signal AbortSignal
optional

Signal object that can be used to abort the asynchronous task. The returned promise will be rejected with an Error named AbortError when an abort is signaled. See also AbortController for more information on how to construct a controller that can be used to deliver abort signals.

Returns
Type Description
Promise Resolves when the resources have loaded.

queryGroups

Method
queryGroups(queryParams, options){Promise<PortalQueryResult>}

Executes a query against the Portal to return an array of PortalGroup objects that match the input query.

Parameters
Autocasts from Object

The input query parameters defined in PortalQueryParams.

options Object
optional

An object with the following properties.

Specification
signal AbortSignal
optional

Signal object that can be used to abort the asynchronous task. The returned promise will be rejected with an Error named AbortError when an abort is signaled. See also AbortController for more information on how to construct a controller that can be used to deliver abort signals.

Returns
Type Description
Promise<PortalQueryResult> 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.

queryItems

Method
queryItems(queryParams, options){Promise<PortalQueryResult>}

Executes a query against the Portal to return an array of PortalItem objects that match the input query.

Parameters
Autocasts from Object

The input query parameters defined in PortalQueryParams.

options Object
optional

An object with the following properties.

Specification
signal AbortSignal
optional

Signal object that can be used to abort the asynchronous task. The returned promise will be rejected with an Error named AbortError when an abort is signaled. See also AbortController for more information on how to construct a controller that can be used to deliver abort signals.

Returns
Type Description
Promise<PortalQueryResult> 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.
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 new PortalQueryParams()
    let 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

Method
queryUsers(queryParams, options){Promise<PortalQueryResult>}

Executes a query against the Portal to return an array of PortalUser objects that match the input query.

Parameters
Autocasts from Object

The input query parameters defined in PortalQueryParams.

options Object
optional

An object with the following properties.

Specification
signal AbortSignal
optional

Signal object that can be used to abort the asynchronous task. The returned promise will be rejected with an Error named AbortError when an abort is signaled. See also AbortController for more information on how to construct a controller that can be used to deliver abort signals.

Returns
Type Description
Promise<PortalQueryResult> 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.
Example
// Once portal is loaded, user signed in
portal.load().then(function() {
   // queryUsers
   // This object autocasts as new PortalQueryParams()
   let 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);
       });
     });
   });
});

removeHandles

Inherited
Method
removeHandles(groupKey)
Inherited from Accessor
Since: ArcGIS Maps SDK for JavaScript 4.25 Accessor since 4.0, removeHandles added at 4.25.

Removes a group of handles owned by the object.

Parameter
groupKey *
optional

A group key or an array or collection of group keys to remove.

Example
obj.removeHandles(); // removes handles from default group

obj.removeHandles("handle-group");
obj.removeHandles("other-handle-group");

when

Method
when(callback, errback){Promise}
Since: ArcGIS Maps SDK for JavaScript 4.6 Portal since 4.0, when added at 4.6.

when() may be leveraged once an instance of the class is created. This method takes two input parameters: a callback function and an errback function. The callback executes when the instance of the class loads. The errback executes if the instance of the class fails to load.

Parameters
callback Function
optional

The function to call when the promise resolves.

errback Function
optional

The function to execute when the promise fails.

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 when() in the same way
let view = new MapView();
view.when(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
});

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.