How to work with the portal service

The general steps to run operations with the portal service.

1. Get the portal url

Before accessing and running operations in a portal, you need to determine the purpose of the work and evaluate whether ArcGIS Online or ArcGIS Enterprise is more suitable based on connectivity, security, scalability, and integration needs. To access a portal, you need an ArcGIS account which is associated with an organization that allows you to store and manage your content.

The base URL for a portal:

Use dark colors for code blocksCopy
1
https://www.arcgis.com/sharing/rest

To get the portal url:

  1. In a web browser, log into your portal with your ArcGIS account.
  2. Identify the portal URL from in the navigation bar.

2. Create an access token

As a developer, an access token is often used to manage and control access to services in a portal. This type of token is commonly used when working with command line apps, developing with the ArcGIS API for Python, or accessing the ArcGIS REST endpoint.

To get an access token, use the generateToken operation and set a username, password, and referer.

cURLcURLHTTP
Use dark colors for code blocksCopy
1
2
3
4
5
6
curl https://www.arcgis.com/sharing/rest/generateToken \
-d 'f=json' \
-d 'username=USERNAME' \
-d 'password=PASSWORD' \
-d 'referer=https://www.arcgis.com' \
-d 'client=referer'

3. Make a request

Once an access token is created, follow these general steps to run an operation:

  1. Make a request to the ArcGIS REST operation endpoint that includes the access token in the request headers for authentication.
  2. Specify the operation parameters within the request payload, defining tasks like spatial analysis or querying specific data services.
  3. Submit the request to the ArcGIS REST API endpoint using the token's authentication to access and run the operation.
  4. Receive the response containing the results or confirmation of the executed operation.

Search for an item example

This example shows how to use a query to search for items in the portal. If many results are returned, use paging.

The public example searches for all items that contain the string, type, and owner. The private example searches for your private items that are web maps.

APIs

ArcGIS Maps SDK for JavaScriptArcGIS Maps SDK for JavaScriptArcGIS API for PythonArcGIS REST JS
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
const portal = new Portal({
  url: "https://www.arcgis.com/"
});
portal.load().then(()=>{
  const query = {
    query: "title: Seven Natural Wonders, type: web map, owner: esri_devlabs"
  };
  portal.queryItems(query).then((response)=>{
    console.log(response);
  });
});

REST API

cURLcURLHTTP
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
## Public

curl https://www.arcgis.com/sharing/rest/search \
-d 'q=title:"Seven Natural Wonders of the World" AND type:"web map" AND owner:"esri_devlabs"' \
-d 'f=pjson'

## Private

curl https://www.arcgis.com/sharing/rest/search \
-d 'q=title:"Seven Natural Wonders of the World" AND type:"web map" AND owner:"<YOUR_USER_ID>"' \
-d 'f=pjson'
-d 'token=<ACCESS_TOKEN>'

API support

SearchItemsUsersGroupsSettingsSecurity
ArcGIS Maps SDK for JavaScript1111
ArcGIS Maps SDK for .NET1111
ArcGIS Maps SDK for Kotlin1111
ArcGIS Maps SDK for Swift1111
ArcGIS Maps SDK for Java1111
ArcGIS Maps SDK for Qt1111
ArcGIS API for Python
ArcGIS REST JS
Esri Leaflet222222
MapLibre GL JS222222
OpenLayers222222
Full supportPartial supportNo support
  • 1. Limited operations, use HTTP requests.
  • 2. Access via ArcGIS REST JS.

Tools

Use tools to access the portal and create and manage content for applications.

Services

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