I'm having an issue creating an item remotely using the item web API. Having tried several permutations of what is in the documentation, I am repeatedly seeing the following in logs:

ERROR Invalid item ID in query string: undefined
WARN  Context item not resolved.
WARN  Cannot resolve the scope because the item set is empty.

I assume it's referring to the parent item, but I get the same errors regardless if I'm using the path as below, sc_itemid, or query to the same path. Here's the code

  var request = WebRequest.CreateHttp(

        request.Headers.Add("X-Scitemwebapi-Username", "sitecore\\admin");
        request.Headers.Add("X-Scitemwebapi-Password", "b");
        request.ContentType = "application/x-www-form-urlencoded";
        request.Method = "POST";
        request.ContentLength = 0;

Any obvious missteps here? TIA!

  • Can you use fiddler (or something similar) to see exactly how this URL is getting generated? Maybe this URL is changing a bit from what you expect and the query string part of the URL is truly undefined when the request is made to Sitecore.
    – DougCouto
    Dec 2, 2016 at 19:32
  • @Barbosa Yeah, tried that. Apart from the encoding of the braces, everything looks as expected - sandbox.local/-/item/v1/sitecore/content/… Dec 2, 2016 at 19:50
  • Obvious question, I know, but gotta ask: /sitecore/content/home is a valid path, right? You don't happen to have an item between Content and Home? I'm sure you don't, but again, gotta ask.
    – DougCouto
    Dec 2, 2016 at 20:00
  • @Barbosa That's not the actual path to the item,but yes the path I'm using is indeed valid. I also tried using the sc_itemid parameter to pass in the ID of the item but got same error. Dec 2, 2016 at 21:22
  • I realize the error you're getting doesn't suggest a security issue but just to rule that out, can you take a look at the security settings described in the guide and try loosing up the security a bit to see if it helps? Here's the guide - sdn.sitecore.net/Products/Sitecore%20Item%20Web%20API/…
    – DougCouto
    Dec 2, 2016 at 22:33


Your Answer

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

Browse other questions tagged or ask your own question.