2

Using the REST API for ItemService to retrieve Sitecore Items with Multilist fields.

curl --cookie ".ASPXAUTH=abcd" -X GET "https://localhost/sitecore/api/ssc/item/7ff9d310-abcd-abcd-abcd-d5fdc5f305b9" 

Result :

{
...
"Multilist": "{A53F9EFA-301B-42CA-A0BE-BFE7A15857E6}|{25F61C2F-0656-4C32-BA35-E913258B4243}",
...
}

The response shows ids instead of the display names. I would like to have the display names instead of the ids in the response.

The UI shows a list of display names - not IDs, for example:

Multilist: test_item1

Question: is there a way to receive the display names instead IDs for cases like Multilist fields with the rest api? (I would like to avoid multiple api calls too.)

3

Try this instead:

https://localhost/sitecore/api/ssc/item/7ff9d310-abcd-abcd-abcd-d5fdc5f305b9?includeStandardTemplateFields=true

It should return a value for __Display name as well as all other standard field values.

I just realized I didn't read all of the question. In the case of a multilist field (or any data field), the field only contains the raw ids, not any additional information. You would need to customize this service to return something else in this case. Or you can return the result, pull the values for the multilist and then query again using the API to get those display names (or any other fields you need).

| improve this answer | |
  • It's also important to note, because the field only stores the id, you will be forced to query the item at some point no matter what. If you modify the service to return everything in one response, it will behind the scenes have to make those additional queries. There is no way to avoid this. – Dylan Young Sep 11 '18 at 19:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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