Gobliins
Gobliins

Reputation: 4026

POST or GET for a validation of some data endpoint in REST?

I have a server endpoint which validates some data and return true/false if the data validation has no errors.

So which Version would be correct or more suitable for a RESTful webservice?

POST https://server.de/validate

POST data in body and return HTTP status code 200 if validation had no errors or

GET https://server.de/validate?=data

Send data in header or query parameter and return true/false in the response (Status code 200 would be returned after a correct request, independent of the data validation).

Upvotes: 1

Views: 4972

Answers (1)

user5890979
user5890979

Reputation:

You should always use POST if the information is sensitive.

Read This thread for more information there are many similar question with yours if you search:

Edit/Update: a good source for seeing the difference

Upvotes: 3

Related Questions