Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7943855
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T00:23:36+00:00 2026-06-04T00:23:36+00:00

I am having a service point implemented with ASP.NET web API. It returns a

  • 0

I am having a service point implemented with ASP.NET web API. It returns a list, an IEnumerable of dto’s embedded within HttpResponseMessage.

However my client code which is implemented via backbone collection fetch always end up with error. Inside the error method, while I pass & watch the parameter I see the collection is appears under ResponseText property.

While I directly pass IEnumerable<dto> without wrapping it with HttpResponseMessage, it works fine.

My question: What is the correct way? How can I make my backbone collection refer to what inside ResponseText property?

I try to play around to make a single model fetch, and override fetch method.

categories = new Categories({ url: 'http://localhost:6685/category' });

$.when(categories.fetch())
    .then(
        function() {
               app.init({ 'categories': categories, 'cart': cart });

               });

This keep giving me ambiguous errors. then when i switched with

categories.fetch({
            success: function() {... },
            error: function(err) {

                console.log(err);
            }
        });

I can see inside err my categories list. the property name is responsetext.

var Categories = Backbone.Collection.extend({

    model: Category,

    initialize: function (options) {
        this.url = options.url;
    },

    parse:function (response) {
        return response.categories;
    },

Server-side

HttpResponseMessage<IEnumerable<category>> httpresponse = null;

 var response= _catalogueservice.getcategories();

            if (response.success)
            {

                httpresponse =  new HttpResponseMessage<IEnumerable<category>>(response.categories, response.categories.Count()>0?HttpStatusCode.Found:HttpStatusCode.NotFound);
            }
            else
            {
                httpresponse = new HttpResponseMessage<IEnumerable<category>>( HttpStatusCode.NotFound);

            }

        return httpresponse;

I can see under fiddler that JSON is being returned.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T00:23:38+00:00Added an answer on June 4, 2026 at 12:23 am

    Always keep your services Dry simple. You are into nightmare when you find out most of the api users have to use another wrapper around data just because of your convenience. Anyways keep that aside below is all that you have to do

    var todos = Backbone.Collection.extend({
    url:"todoapi/gettodos",
    parse:function(response){
       return response.Todos
    }
    });
    

    taking into account your response looks like below

    {Error:"NULL",Todos:[{Id:1,Todo:"Welcome"},{Id:2,Todo:"Eat"...}]}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Having a problem executing a Python script from a .NET web service. The web
I am having difficulty in consuming the reCaptcha Web Service using C#/.Net 3.5. Although
I have a .net web service that takes some xml data. From within the
Is there any point in having a constructor in a Java Web Service class?
I'm having a web service witch I want to use on several domains. However,
Am having some products in my web service. I am getting the product name
I'm having trouble finding/getting any logging output from a web service. I have a
The problem i'm having is that i've created a web service, and a windows
I am having Grails GORM based application.One web service and one website both are
I'm having trouble figuring out why my web service is not working correctly when

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.