Learn what REST is—and what it isn't—and what resources are in the context of REST.
- [Instructor] The internet is full of code and opinions on REST and building restful APIs. REST stands for Representational State Transfer. But, what exactly does that mean? And what does it mean for an API to be "restful?" Let's first clear up some misconceptions and look at what REST is not. Contrary to popular belief, simply using http methods like GET and POST doesn't make your API restful. That just means that you're using http. And just because an API returns JSON doesn't make it restful either. There are plenty of non REST APIs that return JSON.
Finally, just because your API supports CRUD operations like creating and deleting, doesn't make it restful. Restful APIs do use http methods, and can return JSON, and can model CRUD operations. But that's not specifically what makes an API restful. What REST is, is all about modeling your API around resources. And allowing clients to perform operations on those resources. In the context of REST, a resource is any object in your APIs design domain. Things like documents, users, orders, reservations, and tasks.
In many cases, a resource will correlate exactly with a row in a table or an object in the data base. But that's not always the case. So instead of having API endpoints that are verbs, or represent actions you can take in the system, the endpoints in a restful API represent resources or collections of those resources. In addition, relationships between data are represented by relationships between the resources in your API. For example, in the API we'll design for Landon Hotels, a user could have a one to many relationship with reservations at the hotel.
Each reservation resource would then have a link to the corresponding user resource. Restful APIs also need to allow the client to act on a resource, to change some state in the system. Like creating a new reservation or updating a users details. After the state has been updated on the server, some representation of that new or updated state needs to be returned to the client. That's where the name "Representational State Transfer" comes from. You might be thinking that this all sound vaguely familiar. And it is. It's almost identical to the way a web browser works with html.
In fact, web browsers are a great way to get a feel for how REST APIs and REST clients work. We'll explore more of this similarity later in the course. To sum it up, REST is all about modeling your API around resources, links between those resources, and ways to change or act upon those resources. Next, we'll dig deeper into what this means and compare REST with another popular style of APIs called RPC.
- REST vs. RPC
- Using HTTP methods (aka verbs)
- Returning JSON
- Creating a new API project
- Building a root controller
- Routing to controllers with templates
- Requiring HTTPS for security
- Creating resources and data models
- Returning data and resources from a controller
- Representing links (HREFs)
- Representing collections
- Sorting and searching collections
- Creating forms
- Caching and compression
- Authentication and authorization for RESTful APIs
Skill Level Intermediate
Deploying ASP.NET Core Applications (2017)with Nate Barbettini57m 57s Intermediate
1. REST API Concepts
2. Building a Basic API
3. Securing the API
4. Representing Resources
5. Representing Links
6. Representing Collections
7. Sorting Collections
8. Searching Collections
9. Forms and Modifying Data
10. Caching and Compression
11. Authentication and Authorization
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.