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. 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 generate
operation and set a username
, password
, and referer
.
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:
- 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.