Difference between REST call and URL

There's a lot of misinformation and confusion about REST. I'm not surprised that these three points are what you understood from the information available, but they are wrong.

  • REST isn't coupled to any particular data format or media type. The most important constraint in REST is the emphasis on an uniform interface, which means in this case that the server should be able to respond with whatever data format or media type the clients accept. Under HTTP, the client will tell what formats it can understand through the Accept header, and the server should comply or fail with a 406 Not Acceptable error.

  • In the same way, REST isn't coupled to any particular protocol, although it's often convoluted with HTTP. Again, following the uniform interface, the clients should be able to follow any links provided by the server, for any protocol with a valid URI scheme.

  • The semantics of URLs are completely irrelevant to REST. All that matters to REST is that an URL identifies one and only one resource. The URL is an atomic identifier and the client shouldn't rely on any semantics embedded in it for any operations. The two examples you give are both valid in REST. There's nothing more or less RESTful about any of them.

To answer your question, under a REST application the difference you imagine doesn't exist. Hitting an URL will return a response. If the client is requesting with an Accept: text/html header, it may return the human-friendly html page to be rendered by a browser. If the client requests with an Accept: application/json or Accept: application/xml, it may return a machine-friendly format to be read by another application.


REST is just an architectural style, there is no technical difference.

One of the things that REST defines is that your URL needs to be atomic identifiers that refer to only one resource.

GET /users/:id (return the user with the given :id)

PUT /users/:id (update the user with the given :id)

Here is an answer about using a framework to make a REST API in php.


Rest puts more emphasis on the verbs, like GET, PUT, POST... You can call one method like

/api/Customers

and depending on the verb you use it will do a get, post, put or delete. You can also make more easy URL's like

/api/Customers/{id}/Orders/{id}

instead of making a method that would be

api/GetCustomersOrders?id=x&id=y.