0

I am trying to query for a Sitecore item where a particular field has a particular value but am not successfull in doing so.

I am trying to do http://sc8/-/item/v1/?query=/sitecore/content/Home/*[@Title=#Welcome to Sitecore#]

The response I am getting is { "statusCode": 400, "error": { "message": "Bad Sitecore query (/sitecore/content/Home/*[@Title)." } }

Can any one correct me please?

4

I believe the problem is the hash (#) signs instead of quotes (') around values.

This is a sample query from the Item Web API documentation:
/sitecore/content/Home/*[@Title='Welcome to Sitecore']

Documentation link (old, but I could not find any more recent): https://sdn.sitecore.net/upload/sdn5/modules/sitecore%20item%20web%20api/sitecore_item_web_api_developer_guide_sc65-66-usletter.pdf

Hash (#) signs are used to escape item names in the path and field names when they contain protected characters and words:
/sitecore/content/Home/#our-products#/*[@#category-type#='something']

See e.g. these links for more details on the query syntax: https://community.sitecore.net/technical_blogs/b/sitecorejohn_blog/posts/sitecore-query-cheat-sheet https://sdn.sitecore.net/Reference/Using%20Sitecore%20Query/Sitecore%20Query%20Syntax.aspx

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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