I'm using JavaScript to access the API Item Service, why can I retrieve some items via GUID or Path but not other items?

I am using JavaScript / Angular and accessing the API Item Service via GET method i.e: 

[my server]/sitecore/api/ssc/item/[itemID]
I can pull back some items but I also have other (similar items) that will produce a 404 Item Not Found. I have published this item as well. Any suggestions?
  • Hi Chad,

    We are using Item Service Api recently. I have faced similar issues.

    You can try few things:

    • Have you enabled anonymous access for this api? If yes, then this service will use the below access user account to access it. Check in the access viewer whether this service account has read access to the item that you are reading.

             (In Sitecore.Services.Client.config, following configs are used to enable to anonymous access

                  <setting name="Sitecore.Services.AllowAnonymousUser" value="true" />

                <setting name="Sitecore.Services.AnonymousUser" value="sitecore\ServicesAPI" /> )

    • sitecore/api/ssc/item/[ItemId]?includemetadata=true&database=master. Check if you are specifying the right database in the query string. Or else it will pickup the default database. 
    • On safer side, first try to access the item from master database. If it works in master database, not in web, then it could be some issue with publishing.


    Also check your error log, It may have some detailed error.






  • doc.sitecore.com/.../the-restful-api-for-the-itemservice.html

    404 Not Found. The item does not exist or you do not have access to the item.

    Did you check that user that you use for api has access to the mentioned items?
  • In reply to vinesh kumar:

    Thanks for the reply. I have my Sitecore.Services.Client.config configured as mentioned above. My item is not restricted with security. The item I'm trying to retrieve is a template module, are templates off-limits to the API?

    Also, nothing in the error logs.
  • In reply to Chad Neale:

    Hey Chad,

    Templates are not off limit for api. But it's OFF limit for anonymous user account. In this case, for the default impersonating account ("sitecore\ServicesApi") doesn't have access to the Template items. 

    Check the image below for the default access level for ServiceApi user account.

    In our case, we accessed the api from server side. So, we disabled anonymous access and sent account that has high privilege in the authentication header to read the templates.

    In your case, you are accessing from client side JavaScript. So i think you should disable anonymous access and use different account that has privilege to read templates.

    And reading template details (section and fields) from Api is an another story. If you start reading it, you will know it.





  • In reply to vinesh kumar:

    This helped a bunch! Thanks!