Hide Table of Contents
esri/dijit/util
esri/layer/pixelFilters
esri/process
esri/support
esri/workers
Class: Portal

require(["esri/arcgis/Portal"], function(arcgisPortal) { /* code goes here */ });

Description

(Added at v2.8)
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. ArcGIS Portal 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.

Samples

Search for samples that use this class.

Constructors

NameSummary
new Portal(url)Creates a new Portal object.

Properties

NameTypeSummary
accessStringThe access level of the organization.
allSSLBooleanWhen true, access to the organization's Portal resources must occur over SSL.
basemapGalleryGroupQueryStringThe query that defines the basemaps that are displayed in the Basemap Gallery.
bingKeyStringThe Bing key to use for web maps using Bing Maps.
canListAppsBooleanWhether an organization can list applications in the marketplace .
canListDataBooleanWhether an organization can list data services in the marketplace.
canListPreProvisionedItemsBooleanWhether an organization can list pre-provisioned items in the marketplace.
canProvisionDirectPurchaseBooleanWhether an organization can provision direct purchases in the marketplace without customer request.
canSearchPublicBooleanWhen true, the organization's public items, groups and users are included in search queries.
canShareBingPublicBooleanThe Bing key can be shared to the public and is returned as part of a portal's description call (/sharing/rest/portals/<orgid>).
canSharePublicBooleanWhen true, members of the organization can share resources outside the organization.
canSignInArcGISBooleanWhether to allow an organization with an enterprise IDP configured to be able to turn on or off the ArcGIS sign in.
canSignInIDPBooleanWhether to allow an organization with an enterprise IDP configured to be able to turn on or off the enterprise sign in.
colorSetsGroupQueryStringThe query that identifies the group containing the color sets used for rendering in the map viewer.
commentsEnabledBooleanWhether to allow the organization to disable commenting.
createdDateDate the organization was created.
cultureStringThe default locale (language and country) information.
customBaseUrlStringThe custom base URL for the portal.
defaultBasemapObjectThe default basemap the portal displays in the map viewer.
defaultExtentObjectThe default extent for the map the portal displays in the map viewer.
defaultVectorBasemapObjectThe default vector basemap to use for the portal.
descriptionStringA description of the organization / portal.
featuredGroupsObject[]The featured groups for the portal.
featuredGroupsIdStringThe featured groups for the organization.
featuredItemsGroupQueryStringThe query that defines the featured group.
galleryTemplatesGroupQueryStringThe query that identifies the group containing features items for the gallery.
helperServicesObjectHelper services provided by the portal.
homePageFeaturedContentStringThe group that contains featured content to be displayed on the home page.
homePageFeaturedContentCountNumberThe number of featured items that can be displayed on the home page.
httpPortNumberThe port used by the portal for HTTP communication.
httpsPortNumberThe port used by the portal for HTTPS communication.
idStringThe id of the organization that owns this portal.
ipCntryCodeStringThe country code of the calling IP (ArcGIS Online only).
isOrganizationBooleanIndicates if the portal is an organization.
isPortalBooleanIndicates if the portal is on premises.
layerTemplatesGroupQueryStringThe query that defines the collection of editable layer templates.
maxTokenExpirationMinutesNumberThe maximum validity in minutes of tokens issued for users of the organization.
modifiedDateDate the organization was last modified.
nameStringThe Name of the organization / portal.
portalHostnameStringThe portal host's URL.
portalModeStringDenotes multitenant or singletenant.
portalNameStringThe name of the portal, i.e., ArcGIS Online.
portalPropertiesObjectStores properties specific to the organization, for example the "contact us" link.
portalThumbnailStringThe URL to the thumbnail of the portal.
portalUrlStringThe 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.
regionStringThe region for the organization.
rotatorPanelsString[]Custom HTML for the home page.
showHomePageDescriptionBooleanWhether the description of your organization displays on the home page.
supportsHostedServicesBooleanWhether hosted services are supported.
supportsOAuthBooleanWhether OAuth is supported.
symbolSetsGroupQueryStringThe query that defines the symbols sets used by the map viewer.
templatesGroupQueryStringThe query that defines the collection of templates that will appear in the template gallery.
thumbnailStringThe URL to the thumbnail of the organization.
thumbnailUrlStringThe url to the thumbnail of the organization (full path).
unitsStringSets the units of measure for the organization's users.
urlStringThe ArcGIS for Portal URL, for example "https://www.arcgis.com" for ArcGIS Online and "https://www.example.com/arcgis" for your in-house portal.
urlKeyStringThe prefix selected by the organization's administrator to be used with the customBaseURL.
useStandardizedQueryBooleanIf true, only simple where clauses that are complaint with SQL92 can be used when querying layers and tables.
useVectorBasemapsBooleanWhether an organization has opted in to use the vector tile basemaps.
userPortalUserUser information for the accessing user is returned only when a token is passed in.
vectorBasemapGalleryGroupQueryStringThe query that defines the vector tiles basemaps that should be displayed in the Basemap Gallery when useVectorBasemaps is true.

Methods

NameReturn typeSummary
getPortalUser()PortalUserReturns a PortalUser object that describes the user currently signed in to the portal.
queryGroups(queryParams?)DeferredExecute a query against the Portal to return a deferred that when resolved returns PortalQueryResult that contain a results array of PortalGroup objects for all the groups that match the input query.
queryItems(queryParams?)DeferredExecute a query against the Portal to return a deferred that when resolved returns PortalQueryResult that contain a results array of PortalItem objects that match the input query.
queryUsers(queryParams?)DeferredExecute a query against the Portal to return a deferred that when resolved returns PortalQueryResult that contain a results array of PortalUser objects that match the input query.
signIn()DeferredPrompts the user using the IdentityManager and returns a deferred that, when resolved, returns the PortalUser for the input credentials.
signOut()PortalSign out of the Portal which resets the Portal and disables identity checking.

Events

[ On Style Events | Connect Style Event ]
All On Style event listeners receive a single event object. Additionally, the event object also contains a 'target' property whose value is the object which fired the event.

Events

NameEvent ObjectSummary
error
{
  error: <Error>
}
Fires when the signIn() call fails or if the Portal is not able to load.
loadFired when the portal has loaded.
Constructor Details

new Portal(url)

Creates a new Portal object.
Parameters:
<String> url Required The ArcGIS for Portal URL, for example "https://www.arcgis.com" for ArcGIS Online and "https://www.example.com/arcgis" for your in-house portal.
Sample:
require([
  "esri/arcgis/Portal", ... 
], function(arcgisPortal, ... ) {
  var portal = new arcgisPortal.Portal('http://www.arcgis.com');
  ...
}); 
Property Details

<String> access

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

<Boolean> allSSL

When true, access to the organization's Portal resources must occur over SSL.
Known values: true | false

<String> basemapGalleryGroupQuery

The query that defines the basemaps that are displayed in the Basemap Gallery.
Default value: "title:\"ArcGIS Online Basemaps\" AND owner:esri"

<String> bingKey

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

<Boolean> canListApps

Whether an organization can list applications in the marketplace .
Known values: true | false

<Boolean> canListData

Whether an organization can list data services in the marketplace.
Known values: true | false

<Boolean> canListPreProvisionedItems

Whether an organization can list pre-provisioned items in the marketplace.
Known values: true | false

<Boolean> canProvisionDirectPurchase

Whether an organization can provision direct purchases in the marketplace without customer request.
Known values: true | false

<Boolean> canSearchPublic

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.
Known values: true | false

<Boolean> canShareBingPublic

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.
Known values: true | false
Default value: true

<Boolean> canSharePublic

When true, members of the organization can share resources outside the organization.
Known values: true | false

<Boolean> canSignInArcGIS

Whether to allow an organization with an enterprise IDP configured to be able to turn on or off the ArcGIS sign in.
Known values: true | false
Default value: true

<Boolean> canSignInIDP

Whether to allow an organization with an enterprise IDP configured to be able to turn on or off the enterprise sign in.
Known values: true | false
Default value: true

<String> colorSetsGroupQuery

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

<Boolean> commentsEnabled

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.
Known values: true | false
Default value: true

<Date> created

Date the organization was created.

<String> culture

The default locale (language and country) information.

<String> customBaseUrl

The custom base URL for the portal.

<Object> defaultBasemap

The default basemap the portal displays in the map viewer. Returns an object that provides the url and title to the default basemap service.
Sample:
require([
  "esri/map", "dojo/_base/connect", "esri/layers/ArcGISTiledMapServiceLayer", ... 
], function(Map, connect, ArcGISTiledMapServiceLayer, ... ) {
  var map = new Map( ... );
  connect.connect(portal, 'onLoad', function () {
    var initBasemap = new ArcGISTiledMapServiceLayer(portal.defaultBasemap.baseMapLayers[0].url);
    map.addLayer(initBasemap);
  });
  ...
});

<Object> defaultExtent

The default extent for the map the portal displays in the map viewer. The extent will be in the default basemap's spatial reference.
Sample:
require([
  "esri/geometry/Extent", "esri/map", "esri/arcgis/Portal", ... 
], function(Extent, Map, arcgisPortal, ... ) {
  var portal = new arcgisPortal.Portal( ... );
  var initExtent = new Extent(portal.defaultExtent);
  map = new Map("map",{extent:initExtent});
  ...
});

<Object> defaultVectorBasemap

The default vector basemap to use for the portal. Used in the map viewer. (Added at v3.21)
Sample:
require([
  "esri/arcgis/Portal", "dojo/_base/connect"
  ], function(arcgisPortal,connect) {
    var portal = new arcgisPortal.Portal('https://jsapi.maps.arcgis.com/');
    connect.connect(portal, 'onLoad', function() {  
      console.log(portal.defaultVectorBasemap);
    });
  });

<String> description

A description of the organization / portal.

<Object[]> featuredGroups

The featured groups for the portal. Returns an array of objects that provide access to the owner and title for each featured group.
Sample:

  {

    owner: Group Owner, 

    title: Group Title

  }

<String> featuredGroupsId

The featured groups for the organization. These are the groups that will be highlighted on the Groups page.

<String> featuredItemsGroupQuery

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

<String> galleryTemplatesGroupQuery

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.

<Object> helperServices

Helper services provided by the portal. For the detailed information about these services, see the about utility services topic from the ArcGIS Server documentation. (Added at v3.21)

<String> homePageFeaturedContent

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

<Number> homePageFeaturedContentCount

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

<Number> httpPort

The port used by the portal for HTTP communication.

<Number> httpsPort

The port used by the portal for HTTPS communication.

<String> id

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

<String> ipCntryCode

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

<Boolean> isOrganization

Indicates if the portal is an organization.
Known values: true | false

<Boolean> isPortal

Indicates if the portal is on premises.
Known values: true | false

<String> layerTemplatesGroupQuery

The query that defines the collection of editable layer templates.

<Number> maxTokenExpirationMinutes

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

<Date> modified

Date the organization was last modified.

<String> name

The Name of the organization / portal.

<String> portalHostname

The portal host's URL.

<String> portalMode

Denotes multitenant or singletenant.

<String> portalName

The name of the portal, i.e., ArcGIS Online.

<Object> portalProperties

Stores properties specific to the organization, for example the "contact us" link. if the organization is public, the properites are visible to the anonymous user.

<String> portalThumbnail

The URL to the thumbnail of the portal.

<String> portalUrl

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.

<String> region

The region for the organization.

<String[]> rotatorPanels

Custom HTML for the home page.

<Boolean> showHomePageDescription

Whether the description of your organization displays on the home page.
Known values: true | false

<Boolean> supportsHostedServices

Whether hosted services are supported.
Known values: true | false

<Boolean> supportsOAuth

Whether OAuth is supported.
Known values: true | false

<String> symbolSetsGroupQuery

The query that defines the symbols sets used by the map viewer.

<String> templatesGroupQuery

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

<String> thumbnail

The URL to the thumbnail of the organization.

<String> thumbnailUrl

The url to the thumbnail of the organization (full path).

<String> units

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 .

<String> url

The ArcGIS for Portal URL, for example "https://www.arcgis.com" for ArcGIS Online and "https://www.example.com/arcgis" for your in-house portal.

<String> urlKey

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

<Boolean> useStandardizedQuery

If true, only simple where clauses that are complaint with SQL92 can be used when querying layers and tables. The recommended security setting is true.
Known values: true | false

<Boolean> useVectorBasemaps

Whether an organization has opted in to use the vector tile basemaps. (Added at v3.21)
Known values: true | false

<PortalUser> user

User information for the accessing user is returned only when a token is passed in. Group information is not given. See PortalUser for more information.

<String> vectorBasemapGalleryGroupQuery

The query that defines the vector tiles basemaps that should be displayed in the Basemap Gallery when useVectorBasemaps is true. (Added at v3.21)
Method Details

getPortalUser()

Returns a PortalUser object that describes the user currently signed in to the portal. (Added at v3.3)
Return type: PortalUser

queryGroups(queryParams?)

Execute a query against the Portal to return a deferred that when resolved returns PortalQueryResult that contain a results array of PortalGroup objects for all the groups that match the input query.
Return type: Deferred
Parameters:
<Object> queryParams Optional The input query parameters.
Object Specifications:
<queryParams>
<Number> num Required The maximum number of results to be included in the result set response. The Default value is 10 and the maximum allowed value is 100. The start parameter combined with the num parameter can be used to paginate the search results. Note that the actual number of returned results may be less than num if the number of results remaining after start is less than num.
<String> q Required The query string used for a search. View the ArcGIS REST API Search Reference for details on constructing a valid query.
<String> sortField Required A comma separated list of field(s) to sort by. Valid fields are: title, type, owner, avgRating, numRatings, numComments and numViews.
<Number> start Required The number of the first entry in the result set response. The index number is 1-based. The start parameter, along with the num parameter can be used to paginate the search results.
Sample:
require([
  "esri/arcgis/Portal", ... 
], function(arcgisPortal, ... ) {
  var portal = new arcgisPortal.Portal( ... );
  var params = {
    q: 'title: GPX Maps AND owner:esri'
  };
  portal.queryGroups(params).then(function (groups) {
    if (groups.results.length > 0) {
      ...
    }
  });
  ...
});

queryItems(queryParams?)

Execute a query against the Portal to return a deferred that when resolved returns PortalQueryResult that contain a results array of PortalItem objects that match the input query.
Return type: Deferred
Parameters:
<Object> queryParams Optional The input query parameters.
Object Specifications:
<queryParams>
<Number> num Required The maximum number of results to be included in the result set response. The Default value is 10 and the maximum allowed value is 100. The start parameter combined with the num parameter can be used to paginate the search results. Note that the actual number of returned results may be less than num if the number of results remaining after start is less than num.
<String> q Required The query string used for a search. View the ArcGIS REST API Search Reference for details on constructing a valid query.
<String> sortField Required A comma separated list of field(s) to sort by. Valid fields are: title, type, owner, avgRating, numRatings, numComments and numViews.
<Number> start Required The number of the first entry in the result set response. The index number is 1-based. The start parameter, along with the num parameter can be used to paginate the search results.
Sample:
require([
  "esri/arcgis/Portal", "dojo/_base/json", ... 
], function(arcgisPortal, JSON, ... ) {
  var portal = new arcgisPortal.Portal( ... );
  var params = {
    q:'owner:' + 'esri',
    num:5
  };
  portal.queryItems(params).then(function(result){
    console.log('success' + JSON.toJson(result));
  });
  ...
});

queryUsers(queryParams?)

Execute a query against the Portal to return a deferred that when resolved returns PortalQueryResult that contain a results array of PortalUser objects that match the input query.
Return type: Deferred
Parameters:
<Object> queryParams Optional The input query parameters.
Object Specifications:
<queryParams>
<Number> num Required The maximum number of results to be included in the result set response. The Default value is 10 and the maximum allowed value is 100. The start parameter combined with the num parameter can be used to paginate the search results. Note that the actual number of returned results may be less than num if the number of results remaining after start is less than num.
<String> q Required The query string used for a search. View the ArcGIS REST API Search Reference for details on constructing a valid query.
<String> sortField Required A comma separated list of field(s) to sort by. Valid fields are: title, type, owner, avgRating, numRatings, numComments and numViews.
<Number> start Required The number of the first entry in the result set response. The index number is 1-based. The start parameter, along with the num parameter can be used to paginate the search results.
Sample:
portal.queryUsers({q:'username:esri'}).then(function(users){
 var fullName = users.results[0].fullName;
});

signIn()

Prompts the user using the IdentityManager and returns a deferred that, when resolved, returns the PortalUser for the input credentials.
Return type: Deferred
Sample:
portal.signIn().then(function (loggedInUser) {
  loggedInUser.getItems('aaca085e9fa2458582d9f46907da2d5c').then(function (folder) {
    ...
  });
});

signOut()

Sign out of the Portal which resets the Portal and disables identity checking.
Return type: Portal
Sample:
require([
  "esri/arcgis/Portal", "dojo/dom-construct", "dojo/_base/connect", ... 
], function(arcgisPortal, domConstruct, connect, ... ) {
  var portal = new arcgisPortal.Portal( ... );
  portal.signIn().then(function (loggedInUser){
  var signoutlink = domConstruct.create('input',{
    type:'button',
    value:'Sign Out'
  },'toolbarDiv');
  connect.connect(signoutlink,'onclick',function(){
    portal.signOut();
  });
  ...
});
Event Details
[ On Style Events | Connect Style Event ]

error

Fires when the signIn() call fails or if the Portal is not able to load.
Event Object Properties:
<Error> error Error message returned in a JavaScript error object.

load

Fired when the portal has loaded. Once the portal has loaded the properties and methods of the Portal class are available. (Added at v3.6)
Sample:
portal.on("load", function(){
  console.log(portal.allSSL);
});
Show Modal