How to work with items

The general steps to work with items.

1. Create an item

To create and access items, you can use interactive tools, client APIs, or the REST API.

The typical workflow is:

  1. Create and store an item with tools, such as ArcGIS Online and the Location Platform Dashboard.
  2. Manage your items with tools.
  3. Access items in the portal service with a client API or the REST API.
access content
Create, manage, and access content items using the portal service.

Examples

You can create and store new items in the portal by specifying the item type and other required parameters. This request requires an access token.

This example creates a web map item.

NOTE: Child data should also be provided to define the JSON for the web map itself. See Create a web map to learn how to create a web map and get the JSON.

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
const portal = new Portal();
portal.url = "https://www.arcgis.com/"
portal.authMode = "immediate";
// Prompts for username and password
portal.load()
  .then(()=> {
    const item = new PortalItem({
      title: "World geography",
      description: "This is a map of the world",
      tags: ["map", "world", "geography"],
      type: "Web Map"
    });
      const params = {
        item: item
      };
      portal.user.addItem(params).then((response)=>{
        console.log(response); // Item information
      });
});

REST API

cURLcURLHTTP
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
curl https://www.arcgis.com/sharing/rest/content/users/<USER_NAME>/addItem \
-d 'f=pjson' \
-d 'title=World geography' \
-d 'description=This is the map of the world' \
-d 'type=Web Map'\
-d 'tags=map, world, geography' \
-d 'token=<ACCESS_TOKEN>'

2. Manage an item

The easiest way to access and manage an item is to use an item page. An item page is a web page where you can access item properties through tools such as ArcGIS Online and the Location Platform Dashboard.

Item pages

Use dark colors for code blocksCopy
1
https://www.arcgis.com/home/item.html?id=<ITEM_ID>

Examples:

Share an item

To share an item with different users, set the access property. The scope can be public (everyone), organization (your organization members only), group (private or public group), or private (only you).

You must be the item's owner or an administrator for the organization to change this property.

APIs

ArcGIS API for PythonArcGIS API for PythonArcGIS REST JS
Use dark colors for code blocksCopy
1
2
3
4
5
from arcgis.gis import GIS
gis = GIS(username="USERNAME", password="PASSWORD")
item = gis.content.get("ITEM_ID")
results = item.share(everyone=True)
print(results)

REST API

cURLcURLHTTP
Use dark colors for code blocksCopy
1
2
3
4
5
6
curl https://www.arcgis.com/sharing/rest/content/users/<YOUR_ORG>/items/<ITEM_ID>/share \
-d 'everyone=true' \
-d 'org=true' \
-d 'groups=<GROUP_IDs>' \
-d 'f=pjson' \
-d 'token=<ACCESS_TOKEN>'

3. Access an item

To access and work with items in the portal, you can use client APIs or the REST API.

Get an item

To access an item and its properties, you can access it by item ID. The response contains the item properties.

The public example shows how to access a public web map item by its ID. The private example shows how to access any private item that you own by ID.

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
    const item = new PortalItem({
      id: "5a5147abe878444cbac68dea9f2f64e7",
      portal: "https://www.arcgis.com/sharing/rest"
    });
    item.load().then((response)=>{
      console.log(response);
    });

REST API

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

curl https://www.arcgis.com/sharing/rest/content/items/5a5147abe878444cbac68dea9f2f64e7 \
-d 'f=pjson'

## Private

curl https://www.arcgis.com/sharing/rest/content/items/<ITEM_ID> \
-d 'f=pjson' \
-d 'token=<ACCESS_TOKEN>'

Get item data

Items can contain child data. The data is typically stored as text (JSON) or as a reference to services, files, or other resources.

The public example gets the child data for a public web map item. The private example gets the child data for an item that you own. The data returned is the JSON. To create your own private item, see Create a web map.

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
27
28
29
  const item = new PortalItem({
    portal: "https://www.arcgis.com/sharing/rest",
    id: "5a5147abe878444cbac68dea9f2f64e7"
  });
  item.load().then(()=>{
    item.fetchData().then((response)=>{
      console.log(response);
    });
  });

REST API

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

curl https://www.arcgis.com/sharing/rest/content/items/5a5147abe878444cbac68dea9f2f64e7/data \
-d 'f=pjson'

## Private

curl https://www.arcgis.com/sharing/rest/content/items/<ITEM_ID>/data \
-d 'f=pjson' \
-d 'token=<ACCESS_TOKEN>'

Search for an item

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>'

Services

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.

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