DEV Community

raquelhn
raquelhn

Posted on

1

What is REST?

First of all, let's explained what REST stands for:

REpresentation
State
Transfer

Which is a fancy way of saying that a server responds to Create, Read, Update, Delete in a standard way.
It uses the following actions GET, POST, PUT and DELETE to decide which URL to use:
http://example.com/users
http://example.com/users/1

[GET] http://example.com/users
It acts on the entire resource, and get a list of resources
[POST] http://example.com/users
It acts on the entire resource, is used to create a new resource
[GET] http://example.com/users/1
Acts on a single resource, gets the resource with the single ID
[PUT] http://example.com/users/1
Acts on a single resource, updates the resource with the given ID
[DELETE] http://example.com/users/1
Finally the most straighfoward. It acts on a single resource, deletes the resource with the given ID.

While the URLs mentioned are the most common, there can be sligth different details like using users/details/1 or users/update/1 instead.

I hope you find this explanation helpful!

Heroku

Build apps, not infrastructure.

Dealing with servers, hardware, and infrastructure can take up your valuable time. Discover the benefits of Heroku, the PaaS of choice for developers since 2007.

Visit Site

Top comments (0)

AWS Security LIVE!

Join us for AWS Security LIVE!

Discover the future of cloud security. Tune in live for trends, tips, and solutions from AWS and AWS Partners.

Learn More

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay