The ItemService

Abstract

Introduces the implementation and the general usage of the Sitecore ItemService.

The Sitecore ItemService provides a RESTful API that you use to interact directly with Sitecore items.

Sitecore.Services.Client ships with routes that are predefined to interact with the ItemService freeing you from doing any server-side development.

You can use the ItemService in the following ways:

Implementation

The Sitecore.Services.Infrastructure.Sitecore.Controllers.ItemServiceController class implements the ItemService. The class is sealed so that other classes cannot inherit from it. We recommend that you run only one instance of the ItemService on a Sitecore website.

ItemModel return values

Sitecore.Services.Client maps Sitecore items into instances of Sitecore.Services.Core.Model.ItemModel when the ItemService returns them. The ItemModel instances contain the raw field values of the Sitecore item in a Dictionary<string, object> with the following additional keys:

  • ItemID

  • ItemName

  • ItemPath

  • ParentID

  • TemplateID

  • TemplateName

  • CloneSource

  • ItemLanguage

  • ItemVersion

  • DisplayName

  • HasChildren

  • ItemIcon

  • ItemMedialUrl

  • ItemUrl

Examples of ItemService requests

The following examples show how to use the ItemService RESTful API:

Operation

Query string

Get item

/sitecore/api/ssc/item/110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9

Get item including metadata

/sitecore/api/ssc/item/110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9?includeMetadata=true

Get item including standard template fields

/sitecore/api/ssc/item/110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9?includeStandardTemplateFields=true

Get item with field projection

/sitecore/api/ssc/item/110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9?fields=ItemID,ItemName,TemplateName

Search

/sitecore/api/ssc/item/search?term=Home

Search with paging and field projection

/sitecore/api/ssc/item/search?includeStandardTemplateFields=false&fields=ItemID%2CItemName&page=1&term=sitecore

Get media item

/sitecore/api/ssc/item/C19E9164-FF99-4A05-B8C0-E9C931DA111F

Get item using the content path

/sitecore/api/ssc/item/?path=/sitecore/content/Home