4

I am learning about REST services and from what I understood until now the only difference is the language of the file that is outputted by the script that runs as a backend.

Can a regular web server that outputs a HTML file that contains the number of users of a website be considered a REST web service? After all it can be called by a program using a GET request and in the response body there is the number of students inside some tag that can be programatically read by an application after parsing the HTML file like it would parse a JSON of XML in case of more traditional REST service.

There are also web pages where it shows for example details of a book and the book id is sent through the GET request URL. That response may again be parsed by an application that called that URL with the GET verb and than the program can find out information about the book if it knows what is the structure of the HTML file. That again may be seen as a REST web service in my knowledge.

Am I wrong in the way I understood REST services until now?

1 Answer 1

4

HTTP is a standard method, a protocol, for transporting information. REST is a non-standard method for representing state of that information. REST requests take place using the HTTP protocol. That protocol gives methods of exchanging data via GET, POST, DELETE, etc. REST defines how to use those methods but those methods are part of HTTP.

Bad example, HTTP is the air carrying my voice to your ears. REST is how I ask you my question and you give me an answer.

Any web server that handles HTTP can also do REST but some servers, iirc, do not handle DELETE or PUT, both of which are used by REST. Note that REST uses GET/POST/DELETE/PUT but that's part of the HTTP protocol, not REST.

The structure of the HTML file means nothing. What matters is how the information is requested from the server. The state of the information, or page, is kept on the server. That URL remains a constant as it represents some information. Variations of the information change as the URL changes but you always retrieve it from the same URL.

I apologize for rambling cause it's been a while since I've studied this (and I just woke up).

3
  • Thanks for the answer. Why is it used in this case "state of the information" and not only information? What does state has to do with it? Why is state even used in the acronym? I do not see what would be the difference between a website that also allows you to do CRUD operations from a web browser using HTML except the fact that instead of html there is some other format used and you do not have hyperlinks.
    – yoyo_fun
    Apr 28, 2016 at 12:21
  • @yoyo_fun I'm going to have to stop now cause I find I'm editing too much as I try to recall the details and don't want to mislead. I used to know quite a bit, and even talked to Dr. Fielding online about this, but I'm too distracted by other things nowadays.
    – Rob
    Apr 28, 2016 at 12:26
  • Ramble away brother! You did fine. In fact, you did better than fine! Cheers!!
    – closetnoc
    Apr 28, 2016 at 15:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.