1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / The server has not found anything matching the requested URI (Uniform Resource Identifier). (XHR): POST - http://localhost:11321/CustomServices/NewsService/GetNewsTitles

The server has not found anything matching the requested URI (Uniform Resource Identifier). (XHR): POST - http://localhost:11321/CustomServices/NewsService/GetNewsTitles

2 posts, 1 answered
  1. Santosh
    Santosh avatar
    0 posts
    Registered:
    12 May 2017
    23 May
    Link to this post

    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 - http://localhost:11321/CustomServices/NewsService/GetNewsTitles" . 

     

    Link:  http://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

  2. Santosh
    Santosh avatar
    0 posts
    Registered:
    12 May 2017
    31 May
    Link to this post

    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

     

    Answered
2 posts, 1 answered