/relatedItems: Related Items

URL:
https://[root]/content/items/[itemID]/relatedItems
Methods:
GET

Example Usage

URL for Related Items

Use dark colors for code blocksCopy
1
2
3
https://www.arcgis.com/sharing/rest/content/items/a40fddbcd3fc4fadbbb50485a50c3ed0/relatedItems?relationshipTypes=WMA2Code&direction=forward
Relationship Types=WMA2Code
Relationship Direction=forward

Description

The relatedItems operation retrieves all the related items of a certain relationship type or multiple relationship types for that item. An optional direction can be specified if the direction of the relationship is ambiguous. Otherwise, the service will try to infer it.

Only default administrators and item owners have access to related items.

Request parameters

ParameterDetails

[Common Parameters]

For a complete listing, see Common parameters.

[Paging Parameters]

For a complete list of paging parameters, see Paging parameters.

sortField

Field to sort by.

Supported sort field: created

sortOrder

Applies when working with sortField. Describes whether the results return in ascending or descending order. Default is ascending.

Values: asc | desc

direction

The direction of the relationship. Either forward (origin-to-destination) or reverse (destination-to-origin). This is required parameter.

relationshipTypes

The type of relationship between the two items.

Example:

Use dark colors for code blocksCopy
1
relationshipTypes=Map2Service

includeRecycleBin

Returns an item or a set of items from recycle bin. The default is false. This parameter was introduced in the ArcGIS Online June 2024 update.

Values: true | false

Example:

Use dark colors for code blocksCopy
1
https://org.arcgis.com/sharing/rest/content/items/a40fddbcd3fc4fadbbb50485a50c3ed0/relatedItems?relationshipTypes=Service2Service&direction=forward&f=json&includeRecycleBin=true

Response properties

PropertyDetails

[Paging Properties]

The following paging properties are included in the response and they are described in Paging properties.

total, start, num, nextStart

nextKey

Used to fetch the next batch of events by calling with the start parameter.

total

The number of items related using the provided relationship type.

relatedItems

A JSON array of related item objects. See Item for the possible response properties for each item.

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
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
{
  "total": number of related items,
  "relatedItems": [
    {
      "id": "item id",
      "owner": "<owner username>",
      "created": date created shown in UNIX time,
      "modified": date modified shown in UNIX time,
      "guid": unique lpk id,
      "name": "<item name>",
      "title": "<item title>",
      "type": "<type>",
      "typeKeywords": [
        "<type keyword1>",
        "<type keyword2>",
        "<type keyword3>",
        "<type keyword4>",
      ],
      "description": <description>,
      "tags": [
        "<tag1>"
        "<tag2>"
        "<tag3>",
      ],
      "snippet": <summary>,
      "thumbnail": "<file name>",
      "extent": [
        [
          minX,
          minY
        ],
        [
          maxX,
          maxY
        ]
      ],
      "spatialReference": <coordinate reference>,
      "accessInformation": <credits>,
      "licenseInfo": <access and use constraints>,
      "culture": <culture code>,
      "url": <url>,
      "access": "private | shared |  org | public",
      "size": <item size>,
      "numComments": <number of comments>,
      "numRatings": <number of ratings>,
      "avgRating": <average rating>
      "numViews": <number of views>
    }
  ]
}

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
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
{
  "total": 1,
  "relatedItems": [
    {
      "id": "9700ccd8df25439da8cd3b913e8aa469",
      "owner": "jsmith",
      "created": 1252983066000,
      "modified": 1256666605000,
      "guid": null,
      "name": "Map Sample Code",
      "title": "Map Sample Code",
      "type": "Code Attachment",
      "typeKeywords": [
        "sample",
        "map",
        "code"
      ],
      "description": "The code sample provides the information needed to create a web mapping application on your web site.",
      "snippet": "Code sample for a mapping application.",
      "thumbnail": "thumbnail/map_sample.png",
      "extent": [
        [
          -180,
          -90
        ],
        [
          180,
          90
        ]
      ],
      "spatialReference": null,
      "accessInformation": null,
      "licenseInfo": null,
      "culture": en_us,
      "url": null,
      "access": "public",
      "size": 78,
      "numComments": 6,
      "numRatings": 12,
      "avgRating": 3,
      "numViews": 56
    }
  ]
}

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