REST API Server

JasonDavis picture JasonDavis · Dec 15, 2011 · Viewed 21.5k times · Source

I often hear or read the term REST API Server.

I code with PHP and I have done API's for my projects in the past which could return data in XML and JSON formats, and they were in the form of REST where you would do something like

server.com/comments/123 To return/view a comment with ID 123
server.com/comments/post to post a comment
server.com/comments/123/edit to edit comment with ID 123
server.com/comments/123/delete to delete comment with ID 123

Now I would not consider this a REST server but I do think it is REST?

Could someone clarify or explain if I am wrong? I mean is there more to a REST server and it is simply a term used or is a REST server completely different then the functionality I described above?

I have a project coming up soon which will need a RESTful API so I would like to make sure I am doing it correctly.

Answer

EJK picture EJK · Dec 15, 2011

A similar question came up recently: What are RESTful Web Services. Give this a read.

Plus there is a ton of REST information on the web. Here is one of the better overviews I have seen: http://www.xfront.com/REST-Web-Services.html.

In short, your service is not RESTful, but it is close. Rather than specify actions (edit, delete, ...) in URL segments, you will want to make use of HTTP verbs (GET, PUT, POST, DELETE). These details are discussed in the provided links.