/shareItems: Share Items

URL:
https://[root]/content/users/[userName]/shareItems
Methods:
POST

Example Usage

The following is a sample ArcGIS Online POST request for the shareItems operation:

Use dark colors for code blocksCopy
1
2
3
4
5
6
POST /sharing/rest/content/users/jsmith/shareItems HTTP/1.1
Host: org.arcgis.com
Content-Type: application/x-www-form-urlencoded
Content-Length: []

items=93b54c8930ae46d9a00a7820cb3ebbd1,bb8e3d443ab44878ab8315b00b0612ca&groups=4774c1c2b79046f285b2e86e5a20319e,cc5f73ab367544d6b954d82cc9c6dab7&everyone=false&org=false&confirmItemControl=false&f=pjson

The following is a sample ArcGIS Enterprise POST request for the shareItems operation:

Use dark colors for code blocksCopy
1
2
3
4
5
6
POST /<context>/sharing/rest/content/users/jsmith/shareItems HTTP/1.1
Host: organization.example.com
Content-Type: application/x-www-form-urlencoded
Content-Length: []

items=93b54c8930ae46d9a00a7820cb3ebbd1,bb8e3d443ab44878ab8315b00b0612ca&groups=4774c1c2b79046f285b2e86e5a20319e,cc5f73ab367544d6b954d82cc9c6dab7&everyone=false&org=false&confirmItemControl=false&f=pjson

Description

The shareItems operation shares a batch of items with the specified list of groups. Users can only share items with groups to which they belong. This operation also allows a user to share items with everyone, in which case the items are publicly accessible, or with everyone in their organization.

Users assigned either the default administrator role, or a custom role with administrative privileges, may unshare items on behalf of the owner. If an item has a public or org sharing level, there are no sharing restrictions. Items with a private sharing level may only be shared with groups to which the item owner has sharing access.

Request Parameters

ParameterDetails

everyone

If true, the items will be shared with everyone, e.g., they will be publicly accessible.

Values: true | false

org

If true, the items will be shared with everyone in the user's organization. If the user is not part of an organization, setting this to true will return an exception.

Values: true | false

items

A comma-separated list of items to be shared.

groups

A comma-separated list of group IDs with which the items will be shared.

confirmItemControl

Set to true when the items will be shared with groups that have item update capability so that any member of such groups can update the items that are shared with them.

Values: true | false

f

The response format. The default format is html.

Values: html | json | pjson

Response Properties

PropertyDetails

results

An array of JSON objects, one for each item requested. Each object consists of the itemId, a success flag to indicate if the item was successfully shared, and a notSharedWith array with a list of groups the item could not be shared with. If an error occurred in sharing an item, an error object is also returned.

JSON Response Syntax

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
{
  "results": [
    {
      "itemId": "<item ID1>",
      "success": true | false,
      "notSharedWith": [
        <groups not able to share the item with>
      ],
      "error": {
        "code": <error code>,
        "message": "<error message>"
      }
    },
    {
      "itemId": "<item ID2>",
      "success": true | false,
      "notSharedWith": [
        <groups not able to share the item with>
      ]
    }
  ]
}

JSON Response Example

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
{
  "results": [
    {
      "itemId": "3fbb6f64dd3c41da8a5f9dd4be11a9fe",
      "success": false,
      "notSharedWith": [

      ],
      "error": {
        "code": 500,
        "message": "Item does not exist or is inaccessible"
      }
    },
    {
      "itemId": "07efda2ec8934d0cab3b68018758701a",
      "success": true,
      "notSharedWith": [

      ]
    }
  ]
}

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