Q:

REST API: is a redirect (303) a good idea

In my RESTful API I return a redirect (303) in some special cases (e.g. an internal subscription is expired; I know this doesn't sound REST). In order to test my API I wrote a simple webpage using jQuery. However, in case I get a 303 it seems like the browser (XHR?) takes care of the redirect itself and GETs the new resource. As this is hidden from the Ajax call it gets just a 200 at the end. Of course this is misleading as the original call didn't succeed! Obviously this is not what I had in mind: I wanted my client-script to know it has to do something different (-> GET another resource).
Now I'm asking myself whether it's a good idea to even return a 303? Instead I could return a simple 4xx and leave the client on its own.... (probably starting from scratch)
$.ajax({
url: self.links()[0].href,
type: "POST",
statusCode: {
    200: function () {
        //I always ended up here
    },
    303: function () {
    }
},
complete: function (e, xhr, settings) {
    if (e.status === 200) {
        //..and then here
    } else if (e.status === 303) {
    } else {                           
    }
}

A:

jQuery $.ajax always follows redirects. I'm afraid it can't be disabled.
Returning redirect as response to XHR request
How to prevent jQuery ajax from following a redirect after a post?

