Donato Micele Donato Micele - 1 month ago 17
PHP Question

Theory about Rest service

I'm confused about the REST services.

I have a database online and some php scripts.
A script is called "programma.php" and it's accessible at the URL: "www.example.org/programma.php"

This script can be invoked with a request HTTP:


  • if I use the GET method, the program connects to the database and returns in JSON format all the data in a table of the database

  • if I use the POST method, the program inserts into a database table the record sent in the body of the request



The script "programma.php" is a REST service or no? Why?

I'm sorry for my english.

Answer

This is probably best described as a partial implementation of a RESTful service. You also need to provide the list of acceptable transitions in the GET request so that the application can decide dynamically what it can do. It would depend a little more on the actual architecture and separation of responsibility that the system uses as well. But it is essentially a REST implementation, yes.