The ItemService

Last updated Monday, September 12, 2016 in Sitecore Experience Platform for Developer
Keywords: Development

The ItemService provides a single HTTP endpoint and an API that you use to interact with Sitecore items over HTTP.

Sitecore.Services.Client ships with routes that are predefined to interact with the ItemService, and you do not need to do any server-side development to use the ItemService.

You can use the ItemService in three ways:

  • From SPEAK applications, with the StoredQueryDataSource data source. When you use the ItemService this way, it is completely transparent.
  • From client-side JavaScript (in the browser).
  • With the RESTful API that gives direct access to Sitecore items.

Implementation

The Sitecore.Services.Infrastructure.Sitecore.Controllers.ItemServiceController class implements the service. The class is sealed so that other classes cannot inherit from it. We strongly recommended that you run only one single instance of the ItemService in 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 for read-only [GET] operations:

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=Id,Name,TemplateName

Search

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

Search with paging and field projection

/sitecore/api/ssc/item/search?IncludeStandardTemplateFields=False&Fields=ID%2CName&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

Send feedback about the documentation to docsite@sitecore.net.