views:

40

answers:

1

Hello Everybody.

First of all. I want to say that i've acctualy read the other posts (like this) but, i don't think it's a good answer. I mean, what about all the status codes, and HyperMedia, etc. What about caching?

What do you think?

+2  A: 

I agree you do need error handling etc. I've been using Dojo, here's code from my blog

var myEdition = {"Edition":{“author”:”x”, “title”"isbn":"44"}};
      var xhrArgs = {
                url: http://myhost/LibraryWink/library/editions,
                postData: dojo.toJson(myEdition),
                handleAs: "json",
                headers: { "Content-Type": "application/json"},
                load: function(data) {
                    dojo.byId("mainMessageText").innerHTML
                           =  "Message posted.";
                },
                error: function(error) {
                    dojo.byId("mainMessageText").innerHTML
                            = "Error :" + error;
                }
            };
        dojo.byId("mainMessageText").innerHTML
                           = "Message being sent…"; 
        var deferred = dojo.rawXhrPost(xhrArgs);

The relevent points here being a). a framework such as dojo (orI guess jquery) helps b). there is handling for errors.

I also have some thoughts in general about REST services and error handling.

djna
Great djna, i'll take a deeper look.
santiagobasulto