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:
https://www.arcgis.com/sharing/rest
To get the portal url:
- In a web browser, log into your portal with your ArcGIS account.
- Identify the portal URL from in the navigation bar.
2. Set up authentication
To access the portal, you need to set up authentication. The authentication method depends on the type of application you are building and the type of portal you are using. The following are the most common methods:
- API key: API key authentication is a simple method that uses long-lived access tokens to securely access ArcGIS services, items, and perform operations.
- User authentication: Uses OAuth 2.0 to allow users to sign in with their accounts, generating access tokens that grant applications the same privileges as the user's account to access secure resources and services.
Below are tutorials to set up authentication to use the portal service:
Create an API key
Create and configure API key credentials to get a long-lived API key access token.
Create OAuth credentials for user authentication
3. Make a request
Once authentication is set up, follow these general steps to run an operation:
- Make a request to the ArcGIS REST operation endpoint that includes the access token in the request headers for authentication.
- Specify the operation parameters within the request payload, defining tasks like spatial analysis or querying specific data services.
- Submit the request to the ArcGIS REST API endpoint using the token's authentication to access and run the operation.
- 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
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
## 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
- 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.
ArcGIS Enterprise
Create, manage, analyze, and share data, maps, and applications in your organization.
Portal
Create, manage, and access content and data services for applications.
Map Viewer
Create, explore, and share web maps for 2D applications.
Scene Viewer
Create, style, and explore web scenes.
Vector Tile Style Editor
Create styles for basemap and vector tile layers.
Content management tools
Create, manage, organize, and share items in a portal.
Data management tools
Import data and create hosted layers and data services. Upload and manage documents, images, and other files.
Spatial analysis tools
Perform feature and raster analysis to create new datasets with the Map Viewer.
Developer credentials tool
Create API key and OAuth 2.0 developer credentials for custom applications.
Items
Manage and share items.
ArcGIS Pro
Create, style, and explore maps and scenes.
Geoprocessing tools
Import, manage, and analyze data.