A RESTful service is an implementation that follows the patterns of REST. GET, POST, UPDATE, DELETE.
If you are using a POST statement to do a delete, I would not call it RESTful even though it is a REST endpoint.
What is a RESTful service?
What's the difference between REST
and RESTful
service?
How are they useful?
Is it an architecture pattern or application style?
7 answers
Sort by: Most helpful
-
Eric Gruss 16 Reputation points
2019-11-01T14:35:55.517+00:00 -
Robert Horvick 11 Reputation points
2019-11-01T14:22:54.823+00:00 "Web services that conform to the REST architectural style" are called "RESTful Web services". So when you ask what the difference is the answer is that it's just a syntax difference.
You could say:
"I wrote a web service that conforms to the REST architectural style"
Or you could say:
"I wrote a RESTful web service"
And they mean the same thing.
Is REST useful? Sure. It's proven itself to be pretty useful. It's not the only option but it's a popular one.
-
David Hollowell -MSFT 21 Reputation points
2019-11-01T14:28:33.777+00:00 Hi ThiagoLunardi,
I hope you're doing well. There's no difference between REST and RESTful. If a service follows REST principles it is said to be a RESTful service. See https://zcusa.951200.xyz/en-us/azure/architecture/best-practices/api-design for more information about REST principles. -
Thiago Lunardi 16 Reputation points
2019-11-01T12:37:53.05+00:00 REST
According to Wikipedia:
It is thought of how an image of the application design will behave.
That is, it would be something like, depending on how you consume the same feature - a feature that can be visually identified inclusive - your behavior will change.
Let's illustrate to facilitate:
About HTTP Requests
Every time we access something via browser, multiple requests are triggered. When you access any page, a request for the content of that page is created. When this content returns, the browser mounts (renders)the page, but this page requires other features such as images, fonts, stylesheets (css). For each feature, the browser will make a new request.
These requests are composed mainly of three information:
- URL: Address that will receive the request;
- Verb/Method: Command that is desired to be made;
- Body: Information we send, such as data from a form, for example.
As many as the Verbs, there are 4 that are the most used:
- GET: Used to bring information
- POST: To create/add information
- PUT: To tulize information
- DELETE: To delete information ## RESTful Service
They are services that have REST behavior. That is, using the same design, your behavior will change according to the way it is consumed
For example, we have the URL(endpoint)below:
http://www.contoso.com/students
If we want to bring the list of students, just make a request:
GET
Request: [GET] http://www.contoso.com/students Body: empty
The answer will be something like:
Response: HTTP Code 200 OK [ { id: 1, nome: "Thiago Lunardi" }, { id: 2, nome: "Joe Satriani"} ]
But if I want to add a new student, I use the same design, but consuming otherwise, with a request:
POST
Request: [POST] http://www.contoso.com/students Body: { "nome: "Slash" } HTTP Code 201 Created { id: 3, nome: "Slash" }
Continuing, to learn more about a student:
Request: [GET] http://www.contoso.com/students/1 Body: empty Response: HTTP Code 200 OK { id: 1, nome: "Thiago Lunardi", github: "https://github.com/ThiagoLunardi", website: "http://thiagolunardi.net", blog: "https://medium.com/@thiagolunardi", }
To update one-year information, in the same way, we use the same design, and we just change the way we consume the resource, and it will behave differently:
Request: [PUT] http://www.contoso.com/alunos/1 Body: { "twitter": "@thiagolunardi13" } Response: HTTP Code 200 OK { id: 1, nome: "Thiago Lunardi", github: "https://github.com/ThiagoLunardi", website: "http://thiagolunardi.net", blog: "https://medium.com/@thiagolunardi", twitter: "@thiagolunardi13" }
To delete:
Request: [DELETE] http://www.contoso.com/alunos/1 Body: empty Response: HTTP Code 204 No Content
PS: Translated from StackOverflow.
-
Thiago Lunardi 16 Reputation points
2019-11-01T12:51:42.24+00:00 REST
According to Wikipedia:
It is thought of as a image of the application design will behave.
That is, it would be something like, depending on how you consume the same feature - a feature that can be visually identified inclusive - your behavior will change.
Let's illustrate to facilitate:
About HTTP Requests
Every time we access something via browser (browser), several requisitions are triggered. When you access any page, a request for the content of that page is created. When this content returns, browser mounts (render) the page, but this page requires other features such as images, fonts, style sheets (css). For each feature, the browser will make a new request.
These requests are composed mainly of three information:
- URL: Address that will receive the request;
- Verb/Method: Command that is desired to be made;
- Body: Information we send, such as data from a form, for example.
As many as the Verbs, there are 4 that are the most used:
- GET: Used to bring information
- POST: To create/add information
- PUT: To store information
- DELETE: To delete information ### RESTful Service
They are services that have REST behavior. That is, using the same design, your behavior will change according to the way it is consumed
For example, we have the URL (endpoint) below:
http://www.contoso.com/students
If we want to bring the list of students, just make a request
GET
:Request: [GET] http://www.contoso.com/students Body: empty
The answer will be something like:
Response: HTTP Code 200 OK [ { id: 1, name: "Thiago Lunardi" }, { id: 2, name: "Joe Satriani"} ]
But if I want to add a new student, I use the same design, but consuming otherwise, with
POST
request:Request: [POST] http://www.contoso.com/students Body: { "name: "Slash" } HTTP Code 201 Created { id: 3, name: "Slash" }
Continuing, to learn more about a student:
Request: [GET] http://www.contoso.com/students/1 Body: empty Response: HTTP Code 200 OK { id: 1, name: "Thiago Lunardi", github: "https://github.com/ThiagoLunardi", website: "http://thiagolunardi.net", blog: "https://medium.com/@thiagolunardi", }
To update one-year information, in the same way, we use the same design, and we just change the way we consume the resource, now using
PUT
, and it will behave differently:Request: [PUT] http://www.contoso.com/alunos/1 Body: { "twitter": "@thiagolunardi13" } Response: HTTP Code 200 OK { id: 1, name: "Thiago Lunardi", github: "https://github.com/ThiagoLunardi", website: "http://thiagolunardi.net", blog: "https://medium.com/@thiagolunardi", twitter: "@thiagolunardi13" }
To delete, using the
DELETE
:Request: [DELETE] http://www.contoso.com/alunos/1 Body: empty Response: HTTP Code 204 No Content
Translated from StackOverflow.