Learn what REST is (and what it isn't), and what "resources" are in the context of REST.
- 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 API's 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 database 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 user's 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 sounds 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.
- What is RESTful design?
- Building a new API with ASP.NET Core
- Using HTTP methods
- Returning JSON
- Creating RESTful routing with templates
- Securing RESTful APIs with HTTPS
- Representing resources
- Representing links
- Representing collections
- Sorting and searching collections
- Building forms
- Adding caching to an ASP.NET Core API
- Configuring user authentication and authorization
Skill Level Intermediate
1. REST API Concepts
2. Build a Basic API
3. Versioning and Errors
4. Secure the API
5. Represent Resources
6. Represent Links
7. Represent Collections
Add pagination7m 37s
8. Sorting Collections
9. Searching Collections
10. Forms and Modifying Data
11. Caching and Compression
12. 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.