dojo.require("esri.arcgis.Portal");
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
Properties
access | String | The access level of the organization. |
allSSL | Boolean | When true, access to the organization's Portal resources must occur over SSL. |
basemapGalleryGroupQuery | String | The query that defines the basemaps that are displayed in the Basemap Gallery. |
bingKey | String | The Bing key to use for web maps using Bing Maps. |
canListApps | Boolean | Whether an organization can list applications in the marketplace . |
canListData | Boolean | Whether an organization can list data services in the marketplace. |
canListPreProvisionedItems | Boolean | Whether an organization can list pre-provisioned items in the marketplace. |
canProvisionDirectPurchase | Boolean | Whether an organization can provision direct purchases in the marketplace without customer request. |
canSearchPublic | Boolean | When true, the organization's public items, groups and users are included in search queries. |
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>). |
canSharePublic | Boolean | When true, members of the organization can share resources outside the organization. |
canSignInArcGIS | Boolean | Whether to allow an organization with an enterprise IDP configured to be able to turn on or off the ArcGIS sign in. |
canSignInIDP | Boolean | Whether to allow an organization with an enterprise IDP configured to be able to turn on or off the enterprise sign in. |
colorSetsGroupQuery | String | The query that identifies the group containing the color sets used for rendering in the map viewer. |
commentsEnabled | Boolean | Whether to allow the organization to disable commenting. |
created | Date | Date the organization was created. |
culture | String | The default locale (language and country) information. |
customBaseUrl | String | The custom base URL for the portal. |
defaultBasemap | Object | The default basemap the portal displays in the map viewer. |
defaultExtent | Object | The default extent for the map the portal displays in the map viewer. |
defaultVectorBasemap | Object | The default vector basemap to use for the portal. |
description | String | A description of the organization / portal. |
featuredGroups | Object[] | The featured groups for the portal. |
featuredGroupsId | String | The featured groups for the organization. |
featuredItemsGroupQuery | String | The query that defines the featured group. |
galleryTemplatesGroupQuery | String | The query that identifies the group containing features items for the gallery. |
helperServices | Object | Helper services provided by the portal. |
homePageFeaturedContent | String | The group that contains featured content to be displayed on the home page. |
homePageFeaturedContentCount | Number | The number of featured items that can be displayed on the home page. |
httpPort | Number | The port used by the portal for HTTP communication. |
httpsPort | Number | The port used by the portal for HTTPS communication. |
id | String | The id of the organization that owns this portal. |
ipCntryCode | String | The country code of the calling IP (ArcGIS Online only). |
isOrganization | Boolean | Indicates if the portal is an organization. |
isPortal | Boolean | Indicates if the portal is on premises. |
layerTemplatesGroupQuery | String | The query that defines the collection of editable layer templates. |
maxTokenExpirationMinutes | Number | The maximum validity in minutes of tokens issued for users of the organization. |
modified | Date | Date the organization was last modified. |
name | String | The Name of the organization / portal. |
portalHostname | String | The portal host's URL. |
portalMode | String | Denotes multitenant or singletenant . |
portalName | String | The name of the portal, i.e., ArcGIS Online. |
portalProperties | Object | Stores properties specific to the organization, for example the "contact us" link. |
portalThumbnail | String | The URL to the thumbnail of the portal. |
portalUrl | 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. |
region | String | The region for the organization. |
rotatorPanels | String[] | Custom HTML for the home page. |
showHomePageDescription | Boolean | Whether the description of your organization displays on the home page. |
supportsHostedServices | Boolean | Whether hosted services are supported. |
supportsOAuth | Boolean | Whether OAuth is supported. |
symbolSetsGroupQuery | String | The query that defines the symbols sets used by the map viewer. |
templatesGroupQuery | String | The query that defines the collection of templates that will appear in the template gallery. |
thumbnail | String | The URL to the thumbnail of the organization. |
thumbnailUrl | String | The url to the thumbnail of the organization (full path). |
units | String | Sets the units of measure for the organization's users. |
url | String | 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. |
urlKey | String | The prefix selected by the organization's administrator to be used with the customBaseURL . |
useStandardizedQuery | Boolean | If true , only simple where clauses that are complaint with SQL92 can be used when querying layers and tables. |
useVectorBasemaps | Boolean | Whether an organization has opted in to use the vector tile basemaps. |
user | PortalUser | User information for the accessing user is returned only when a token is passed in. |
vectorBasemapGalleryGroupQuery | String | The query that defines the vector tiles basemaps that should be displayed in the Basemap Gallery when useVectorBasemaps is true. |
Methods
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
error | {
error: <Error >
} | Fires when the signIn() call fails or if the Portal is not able to load. |
load | | Fired when the portal has loaded. |
Old Events
onLoad() | Fired when the portal has loaded. |
Constructor Details
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:
var portal = new esri.arcgis.Portal('http://www.arcgis.com');
Property Details
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
When true, access to the organization's Portal resources must occur over SSL.
Known values: true | false
The query that defines the basemaps that are displayed in the Basemap Gallery.
Default value: "title:\"ArcGIS Online Basemaps\" AND owner:esri"
The Bing key to use for web maps using Bing Maps.
Whether an organization can list applications in the marketplace .
Known values: true | false
Whether an organization can list data services in the marketplace.
Known values: true | false
Whether an organization can list pre-provisioned items in the marketplace.
Known values: true | false
Whether an organization can provision direct purchases in the marketplace without customer request.
Known values: true | false
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
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
When true, members of the organization can share resources outside the organization.
Known values: true | false
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
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
The query that identifies the group containing the color sets used for rendering in the map viewer.
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 the organization was created.
The default locale (language and country) information.
The custom base URL for the portal.
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:
dojo.connect(portal, 'onLoad', function () {
var initBasemap = new esri.layers.ArcGISTiledMapServiceLayer(portal.defaultBasemap.baseMapLayers[0].url);
map.addLayer(initBasemap);
});
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:
var initExtent = new esri.geometry.Extent(portal.defaultExtent);
var map = new esri.Map("map",{extent:initExtent});
The default vector basemap to use for the portal. Used in the map viewer. (Added at v3.21)
A description of the organization / portal.
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
}
The featured groups for the organization. These are the groups that will be highlighted on the Groups page.
The query that defines the featured group. If null, then the most viewed items in the organization will be the featured items.
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.
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)
The group that contains featured content to be displayed on the home page.
The number of featured items that can be displayed on the home page. The max is 100. Integers only.
The port used by the portal for HTTP communication.
The port used by the portal for HTTPS communication.
The id of the organization that owns this portal. If null then this is the default portal for anonymous and non organizational users.
The country code of the calling IP (ArcGIS Online only).
Indicates if the portal is an organization.
Known values: true | false
Indicates if the portal is on premises.
Known values: true | false
The query that defines the collection of editable layer templates.
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 the organization was last modified.
The Name of the organization / portal.
Denotes multitenant
or singletenant
.
The name of the portal, i.e., ArcGIS Online.
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.
The URL to the thumbnail of the 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.
The region for the organization.
Custom HTML for the home page.
Whether the description of your organization displays on the home page.
Known values: true | false
Whether hosted services are supported.
Known values: true | false
Whether OAuth is supported.
Known values: true | false
The query that defines the symbols sets used by the map viewer.
The query that defines the collection of templates that will appear in the template gallery.
The URL to the thumbnail of the organization.
The url to the thumbnail of the organization (full path).
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 .
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.
The prefix selected by the organization's administrator to be used with the customBaseURL
.
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
Whether an organization has opted in to use the vector tile basemaps. (Added at v3.21)
Known values: true | false
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.
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
Returns a PortalUser object that describes the user currently signed in to the portal. (Added at v3.3)
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.
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:
var params = {
q: 'title: GPX Maps AND owner:esri'
};
portal.queryGroups(params).then(function (groups) {
if (groups.results.length > 0) {
...
}
});
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.
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:
var params = {
q:'owner:' + 'esri',
num:5
};
portal.queryItems(params).then(function(result){
console.log('success' + dojo.toJson(result));
});
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.
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;
});
Prompts the user using the
IdentityManager and returns a deferred that, when resolved, returns the PortalUser for the input credentials.
Sample:
portal.signIn().then(function (loggedInUser) {
loggedInUser.getItems('aaca085e9fa2458582d9f46907da2d5c').then(function (folder) {
...
});
});
Sign out of the Portal which resets the Portal and disables identity checking.
Sample:
portal.signIn().then(function (loggedInUser){
var signoutlink = dojo.create('input',{
type:'button',
value:'Sign Out'
},'toolbarDiv');
dojo.connect(signoutlink,'onclick',function(){
portal.signOut();
});
Event Details
[ On Style Events | Connect Style Event ]
Fires when the
signIn()
call fails or if the
Portal
is not able to 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);
});
Fired when the portal has loaded. Once the portal has loaded the properties and methods of the Portal class are available.
Sample:
dojo.connect(portal,'onLoad',function(){
console.log(portal.allSSL);
});