I'm trying to use the Sitecore RESTful API to retrieve item children via Javascript. I'm following the documentation here: https://doc.sitecore.net/sitecore_experience_platform/developing/developing_with_sitecore/sitecoreservicesclient/the_restful_api_for_the_itemservice
I'm using the following Javascript function:
function loadChildren(id, parentNode) {
var xhr = new XMLHttpRequest();
xhr.open("GET", window.location.protocol + "//" + window.location.hostname + "/sitecore/api/ssc/item/" + id + "/children");
xhr.onreadystatechange = function () {
if (this.readyState == 4) {
console.log(this.responseText);
var innerHtml = "<ul>"
innerHtml += "</ul>";
$(parentNode).append(innerHtml);
}
};
xhr.send(null);
}
But the GET request is returning the "page not found" HTML. Do I need to install something for this to work? I'm using Sitecore 7.1
Turns out I had to enable the Sitecore Item API in my config (Sitecore.ItemWebApi.config):