0
votes

I am using the Sitecore Web Api to access my Content tree from a non Sitecore web application, but when I try the request I get an 404 file not found error. I have tripled check the GIUD, so that is not the problem.

The settings in the web.config and sitecore.ItemWebApi.config

<setting name="IgnoreUrlPrefixes" value="....|/-/item/v1/|...."/>

<site name="website">
    <patch:attribute name="itemwebapi.mode">StandardSecurity</patch:attribute>
    <patch:attribute name="itemwebapi.access">ReadOnly</patch:attribute>
    <patch:attribute name="itemwebapi.allowanonymousaccess">true</patch:attribute>
</site>

The HttpWebRequest

HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://example.com/-/item/v1/?sc_itemid={5E219167-DCC0-4C28-A123-064CACCCCE69}");

var response = (HttpWebResponse)request.GetResponse();
2
Are you able to access the endpoint through a rest client such as Fiddler or Postman? - xoail
I have not tired. I am pretty new to sitecore, how would I go about doing that? - Sean Fleming
I used PostMan and I still get the 404 - Sean Fleming
Which version of Sitecore are you using? - jammykam
7.1. The ItemWebApi is version 1 - Sean Fleming

2 Answers

0
votes

Few things you can try:

  • Make sure the guid is correct and there are no restrictions on it from sitecore client
  • Make sure the item is published unless you are running in Live mode
  • Try accessing the REST endpoint through PostMan
  • Try accessing the Home item's REST endpoint through PostMan
  • Check sitecore logs for any errors
0
votes

I resolved the issue. First of all my host name didn't resolve directly to a site in IIS, secondly the dll was corrupted.