My users enter a few information fields in an iOS app. This information must be validated on my server, which has a RESTful API. After validation the UI of the iOS app changes to indicate the result.
Neither GET, PUT, or POST seem to be appropriate, because I'm not getting a resource, and neither is a resource created or updated.
What is the best fitting REST operation to implement this validation?
GET requests should be used to retrieve data when designing REST APIs; POST requests should be used to create data when designing REST APIs.
The Validate REST Request filter enables you to validate the following aspects of a REST request: The HTTP method used in the request. Each of the path parameters against a set of restrictive conditions called a request parameter restriction. Each of the query string parameters against a request parameter restriction.
The POST method is used to request that the origin server accept the entity attached in the request as a new subordinate of the resource identified by the Request-URI in the Request-Line. It essentially means that POST request-URI should be of a collection URI.
I use the same scenario as you and use PUT for it. You have to ask yourself: "when I send the same request twice, does this make a different state on server?" If yes, use POST, if no use PUT.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With