1

What exactly does a REST request do differently to a query when trying to get data from the database? I've been learning this and it only looks like a more complicated way of doing something for the same result.

  • 1
    Here's a good answer : http://stackoverflow.com/questions/2191049/what-is-the-advantage-of-using-rest-instead-of-non-rest-http – teeyo Nov 03 '14 at 11:15

1 Answers1

3

If you are writing a REST service in PHP

Nothing.

REST describes how the browser interacts with the webservice over HTTP. How the PHP program supplying the webservice gets the data to respond with is irrelevant to the RESTful nature of it. If the data is in a database, you just continue to use PDO or some other database library.

If you are using PHP as a REST client

Instead of using a database API (like PDO or mysqli_), you use an HTTP client library (like cURL) and request the data using HTTP with the details of the request encoded in the URI (or the PUT or POST message body for UPDATE and INSERT-like query equivalents).

Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335