Skip To Content
ArcGIS Developer
Dashboard

/relatedItems: Related Items

  • URL:https://[root]/content/items/[itemID]/relatedItems

Example Usage

URL for Related Items

 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.

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.

f

The response format. The default format is html.

Values: html | json | pjson

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


{
  "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


{
  "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
    }
  ]
}