CodePlexProject Hosting for Open Source Software
is any one implemented POST-Get-Redirect scenoria with WCF WebAPI . is so how to do it.
Do you mean where every POST is redirected to the same request, but as GET?
That doesn't apply to APIs... that only applies to Web UIs.
No , Once the post a resource back to the server you want to redirect the Client to the different page ,Its like giving 301,302 to the Client
Sounds like your answer is "yes", not "no".
I don't think that that methodology should be anywhere near WebApi.
May be a small problem and solution approach will help you understand more..
Lets imagine i have a Customer representation from the server to the client and there is an edit happened in client and i will post the edited data to the server and ask the client to move to the different Resource . How will you do through REST..
You don't do that with REST.
With rest when you edit a resource, you return the edited resource in the response.
Anyways. You can do it like this:
public class myservice
public HttpResponseMessage<int> Post(int x)
var m = new HttpResponseMessage(HttpStatusCode.Redirect);
m.Headers.Location = new Uri("");
m.Content = new ObjectContent<int>(1);
You mean to say Put can't return 301 or 302 as the success code .Is there any reason in not doing it
I didn't say can't, I meant it shouldn't.
If a user asks for one resource, why are you giving them another one. That doesn't make any sense.
IMHO ,Hypermedia as engine of application state gives the client a direction to the which is the next logical to take after each action . According to me PUT Verb is a Action on the resource should also say can say which is the next action the client should
take.Correct me if i am wrong
Well this is why there are so many derivations of what "REST" means ;)
One person implements it one way, the other another. If you follow my example above, that should give you your intended result.
Are you sure you want to delete this post? You will not be able to recover it later.
Are you sure you want to delete this thread? You will not be able to recover it later.