nobody
nobody

Reputation: 8293

Debate on GET vs POST with RESTful Service

So I have an ajax call that calls a controller action that fires off a package for execution that is separate from my main application which returns a result. That result (a success or failure) is what I want returned from that controller action and the ajax action is currently a GET request with the parameters for the package being sent with the request. Should this be a GET request to be 'RESTful', or should it be a POST request?

Upvotes: 0

Views: 1049

Answers (1)

DBueno
DBueno

Reputation: 132

I would say it should be a POST. GET should have no other effects then to retrieve a representation of data. Here's what W3C says.

Use GET if:

  • The interaction is more like a question (i.e., it is a safe operation such as a query, read operation, or lookup).

Use POST if:

  • The interaction is more like an order, or
  • The interaction changes the state of the resource in a way that the user would perceive (e.g., a subscription to a service), or
  • The user be held accountable for the results of the interaction.

Upvotes: 2

Related Questions