What is a RESTful service?

Thiago Lunardi 16 Reputation points
2019-11-01T12:30:18.957+00:00

What's the difference between REST and RESTful service?

How are they useful?

Is it an architecture pattern or application style?

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
40,096 questions
0 comments No comments
{count} votes

7 answers

Sort by: Most helpful
  1. Kenneth Orwig III 1 Reputation point
    2019-11-01T21:01:50.907+00:00

    Hi @Thiago Lunardi

    There is no technical difference between the terms – you may as well have asked about “Color” vs. “Colorful”.

    REST is an architectural style with well defined constraints. That is, if your system does not conform to them, then it is not a RESTful system.

    Here are the constraints:

    • Statelessness – session-state is maintained by the client and the server never stores any client context between requests.

    • Uniform Interface – ultimately, clients should be able to enter, understand, and use a RESTful system knowing nothing more than the entry point.

    • Client-Server Architecture – This shouldn’t really need much explanation: decoupling a UI from the application and storage allows for simpler interactions and reusability of component application segments.

    • Cacheability – Can be implemented on the client or server side and must be declared in every case.

    • Layered System – APIs may be deployed to one server although the processing, storage, authentication, and other concerns may happen elsewhere.

    • OPTIONAL: code on demand – when returning static representations pf resources in JSON or XML won’t do, just go ahead and return executable code – you are allowed.

    Here are a few other useful points:

    • REST is often compared to SOAP but this is like comparing apples to oranges. SOAP is a protocol – REST is not.

    • REST is protocol independent. We often use it with HTTP but we could just as easily use a different protocol for a different purpose.

    • A good understanding of hypermedia and HATEOAS is crucial to getting the Uniform Interface constraint satisfied effectively.

    • No one is going to grade you on how well your system conforms to REST and occasional deviations are encountered in even the most sophisticated systems. Just know that the closer you get to pure REST, the longer you can expect your application to remain relevant to your organization.

    Hope this helps!

    0 comments No comments

  2. Tariq Ahmed 1 Reputation point
    2019-11-30T22:07:06.203+00:00

    REST is a client-server architecture which (among other things) leverages the full capacity of the HTTP protocol.

    Some relevant points in REST:

    Each URL on the server represents a resource; either a collection resource or an element resource.
    A collection resource would be available at a URL like http://restful.ex/items/ which would be a representation of a list of items.
    A element resource would be available at a URL like http://restful.ex/items/2 which would be a representation of a single item, identified by 2.
    Different HTTP methods are used for different CRUD operations:
    a GET is a read operation
    a PUT is a write/modify operation
    a POST is a create/new operation
    a DELETE is a... ok, that one is kind of self-explanatory.
    State (or rather, client context) is not stored on the server-side; all state is in the representations passed back and forth by the client's requests and the server's responses.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.