0

I am in the need to expose a restful api which eventually will insert items to bucket list available in sitecore. This api will be cosnumed by another MVC application to push records into sitecore bucket-list. I have following queries.

  1. Will it possible to create restful api in sitecore using Sitecore Item Web API
  2. Is there any better way of implementing this feature.

I am using sitecore 7.2

1
  • What makes you think that you can't use Sitecore Item Web API as restful? Have you tried and it wasn't working?
    – grg
    Dec 4, 2017 at 11:47

1 Answer 1

2

Yes, the Sitecore Item Web API can be used to create items via HTTP POST requests.

You do this by POSTing to a URL such as this, to specify the parent item and template to use:

http://[host name]/-/item/v1?sc_itemid={XXXXXXXX-ITEM-GUID-HERE-XXXXXXXXXXXX}&template={XXXXXXXX-TMPL-GUID-HERE-XXXXXXXXXXXX}&sc_database=master&name=MyNewItem

And field contents are provided as a x-www-form-urlencoded body, e.g.:

fieldname=fieldvalue&anotherfieldname=fieldvalue

The full documentation for the Item Web API has more details, including how to manage the security of this API. Though it states up to Sitecore 7.1, this documentation is also applicable to Sitecore 7.2.

With respect to item buckets, you can use the standard API for this. As long as the new item template is set to be Bucketable in the Standard Values, and the parent item you are creating the new item under is a bucket, this will be created as a bucket item without needing any special treatment.

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.