The server has not found anything matching the requested URI (Uniform Resource Identifier). (XHR): POST - localhost:11321/.../GetNewsTitles
I have tried to create a RESTful WCF service to retrieve titles of news items suing the tutorial at the mentioned link below but my console says "HTTP404: NOT FOUND - The server has not found anything matching the requested URI (Uniform Resource Identifier).
(XHR): POST - localhost:11321/.../GetNewsTitles" .
Link: docs.sitefinity.com/tutorial-create-a-restful-wcf-service-to-retrieve-titles-of-news-items
I used JavaScript widget to call the service with ajax call as mentioned in the tutorial.
What is that I'm missing?
Would appreciate your inputs.
Screenshot attached for the project folder structure in VS.
Thanks,
Santosh
No need to create any rest service to news items. Sitefinity provides inbuilt. Below lines of code should give you everything related to News items.
My script in Javascript widget inside a page :
$.ajax(
type: "GET",
url: "/sitefinity/services/content/newsitemservice.svc/",
contentType: "application/json; charset=utf-8",
dataType: "json",
data: JSON.stringify( skip: 0, take: 10 ),
success: function (result) console.log(result);
for(var i=0; i<=result.TotalCount;i++)
$("#Mydata").append(result.Items[i].Title); /* #Mydata is the id of a div placed in my page in content block widget to append my results to show on my page */
,
error: function (error) alert(error);
);
Also Sitefinity provides rest services for all the inbuilt content. You can find them in your project folder with path as YourProject/Sitefinity/Services in visual studio.
Thanks,
Santosh