1

Is there any way to get Item or Item id using Sitecore Service client based on the fields in the master database.

Search term:

http://{host}/sitecore/api/ssc/item/search?term=12345&includeStandardTemplateFields=False&fields=Email

Result JSON:

"TotalCount": 1,
  "TotalPage": 1,
  "Links": [],
  "Results": [
    {
      "Email": "emailid"
    }

But I need the Item Id or Item itself

1 Answer 1

4

Yes it is feasible to get the item id from the return result. You just need to add the itemidin the field projection. Please see below the updated Rest API

http://{host}/sitecore/api/ssc/item/search?term=12345&includeStandardTemplateFields=False&fields=Email,itemid

I did a small test with the home item and the result are shown below (which returns the item id from where it got the result)

REST API

http://{domain}c/sitecore/api/ssc/item/search?term=home&includeStandardTemplateFields=False&fields=itemid,title

Response

{
  "TotalCount": 2,
  "TotalPage": 1,
  "Links": [],
  "Results": [
    {
      "ItemID": "8e18ac80-0084-4859-8df4-d8a2fffa5f3b"
    },
    {
      "ItemID": "110d559f-dea5-42ea-9c1c-8a5df7e70ef9",
      "Title": "Sitecore Experience Platform"
    }
  ]
}

More information can be obtained from the Sitecore Documentation - The ItemService.

In the section ItemModel return values, it shows what are the different values that it returns. You just need to specify them in the field projection.

2
  • Hishaam Namooya , okay i will try. Feb 23, 2020 at 10:39
  • Thanks Hishaam Namooya, its working. Feb 23, 2020 at 10:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.