The 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:
-
Directly with the
ItemService
RESTful API. -
From SPEAK applications with the StoredQueryDataSource data source. When you use the
ItemService
this way, it is completely transparent.
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 |
|
Get item including metadata |
|
Get item including standard template fields |
|
Get item with field projection |
|
Search |
|
Search with paging and field projection |
|
Get media item |
|
Get item using the content path |
|