1
votes

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).

1
Its not ideal to have verbs in the uri as validate in rest terminologies.. This is more like procedural oriented.. You have to idenitify this in terms of resource and convert this to get and post on the resource which you have to validate...Janier
True, i have called it validation.Gobliins
Neither URI is Restful. Neither URI is acting as a resource which the document you're transferring to it is a representation. Rather, the endpoints are acting as processors which transform the data being sent to them. You should either rethink your URI structures completely or stop calling what you're doing REST.sisyphus

1 Answers

3
votes

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