Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Frankly, the answer depends on context. REST and RESTful have meanings depending on what language or framework you're using or what you're trying to accomplish. Since you've tagged your question under "web services" I'll answer in the context of RESTful web services, which is still a broad category.</p> <p>RESTful web services can mean anything from a strict REST interpretation, where all actions are done in a strict "RESTful" manner, to a protocol that is plain XML, meaning its not SOAP or XMLRPC. In the latter case, this is a misnomer: such a REST protocol is really a <a href="http://en.wikipedia.org/wiki/Plain_Old_XML" rel="nofollow noreferrer">"plain old XML" (or "POX") protocol</a>. While REST protocols usually use XML and as such are POX protocols, this doesn't necessarily have to be the case, and the inverse is not true (a just because a protocol uses XML doesn't make it RESTful).</p> <p>Without further ado, a truly RESTful API consists of actions taken on objects, represented by the HTTP method used and the URL of that object. The actions are about the data and not about what the method does. For example, CRUD actions (create, read, update, and delete) can map to a certain set of URLs and actions. Lets say you are interacting with a photo API.</p> <ul> <li>To create a photo, you'd send data via a POST request to /photos. It would let you know where the photo is via the Location header, e.g. /photos/12345</li> <li>To view a photo, you'd use GET /photos/12345</li> <li>To update a photo, you'd send data via a PUT request to /photos/12345.</li> <li>To delete a photo, you'd use DELETE /photos/12345</li> <li>To get a list of photos, you'd use GET /photos.</li> </ul> <p>Other actions might be implemented, like the ability to copy photos via a COPY request.</p> <p>In this way, the HTTP method you're using maps directly to the intent of your call, instead of sending the action you wish to take as part of the API. To contrast, a non-RESTful API might use many more URLs and only use the GET and POST actions. So, in this example, you might see:</p> <ul> <li>To create a photo, send a POST to /photos/create</li> <li>To view a photo, send a GET to /photos/view/12345</li> <li>To update a photo, send a POST to /photos/update/12345</li> <li>To delete a photo, send a GET to /photos/delete/12345</li> <li>To get a list of photos, send a GET to /photos/list</li> </ul> <p>You'll note how in this case the URLs are different and the methods are chosen only out of technical necessity: to send data, you must use a POST, while all other requests use GET.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload