Sharing items

The sharing levels in a portal provide users with flexibility in controlling the accessibility of their content, allowing them to configure access based on the audience and the sensitivity of the information. By selecting the appropriate sharing level for each item, users can collaborate and properly secure their content within a portal.

The following is a list of the sharing levels available for the different types of ArcGIS products:

  • Owner (private): Only the owner has access. The hosted layer (item) and data service are private and will not be visible or accessible to others. A valid access token or scoped API key is required. Learn more about scoping items to an API key in API keys.

How to set the sharing level

When you create a new data service, the hosted layer (item) and data service sharing level (privacy setting) is set to Owner. The item and data service are only available to you. This setting requires that applications provide a valid access token to authenticate requests to view the item or access the data service.

The steps to change the sharing properties are:

  1. Sign into a data management tool with your ArcGIS account:

  2. Find the item.
  3. Use the item page to change the sharing setting.

Code examples

You can use data management tools to manage the sharing level of a hosted feature layer (item) or you can use ArcGIS APIs. The following examples illustrate how to set the sharing level of a hosted feature layer (item).

Set sharing to public

By default, the sharing level of a newly created item is set to private. Allow unrestricted access to the hosted layer (item) and data service. An access token is not required to access the service.

API

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
// Import the ArcGIS REST API module
const arcgisRestApi = require('@esri/arcgis-rest-portal');

// Set up the authentication credentials
const credentials = new arcgisRestApi.UserSession({
  username: 'your_username',
  password: 'your_password'
});

// Set up the item ID of the item you want to share
const itemId = 'your_item_id';

// Share the item to the public
arcgisRestApi.shareItem({
  id: itemId,
  username: credentials.username,
  everyone: true,
  authentication: credentials
})
  .then(response => {
    console.log('Item shared to the public successfully!');
  })
  .catch(error => {
    console.error('Error sharing item to the public:', error);
  });

REST API

This sharing level is not available.

Change sharing level for an item

Use share (POST) as the item owner to edit your item's level of access. The sharing parameters are: everyone (accessible to the public), org, and groups. To perform this call, specify the item ID and set each parameter to a boolean (true or false) and, optionally, the group-id for sharing. When sharing is set to false, your item permissions are set as private.

API

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
// Import the ArcGIS REST API module
const arcgisRestApi = require('@esri/arcgis-rest-portal');

// Set up the authentication credentials
const credentials = new arcgisRestApi.UserSession({
  username: 'your_username',
  password: 'your_password'
});

// Set up the item ID of the item you want to update the sharing level for
const itemId = 'your_item_id';

// Set the sharing level to private for the item
arcgisRestApi.updateItem({
  id: itemId,
  username: credentials.username,
  access: 'private',
  authentication: credentials
})
  .then(response => {
    console.log('Sharing level set to private successfully!');
  })
  .catch(error => {
    console.error('Error setting sharing level to private:', error);
  });

REST API

This sharing level is not available.

Tutorials

Import data to create a feature layer

Use data management tools to import files and create a feature layer in a feature service.


Define a new feature layer

Use data management tools to define and create a new empty feature layer in a feature service.


Manage a feature layer

Use a hosted feature layer item to set the properties and settings of a feature layer in a feature service.


Create a vector tile service

Use data management tools to create a new vector tile service from a feature service.


Create a map tile service

Use ArcGIS Online or scripting APIs to publish a map tile service.


Services

Tools

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