Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

REST API Server

Tags:

rest

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.

like image 527
JasonDavis Avatar asked Dec 15 '11 02:12

JasonDavis


1 Answers

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.

like image 130
EJK Avatar answered Oct 18 '22 18:10

EJK