REST Foundations in API

Lessons in this section

  1. Introduction to APIs

    Learn what an API is, how a client and a server talk through requests and responses, and why every API is a contract. Break one and fix it in your browser.

  2. HTTP Basics

    Read every line of a real HTTP request and response: the method, path, query string, headers and JSON body, and why a missing Content-Type breaks a request.

  3. HTTP Methods

    Learn GET, POST, PUT, PATCH and DELETE, what safe and idempotent mean, and how an Idempotency-Key stops a retried payment from charging twice.

  4. REST API Design and URL Naming

    Turn action-style endpoints into clean REST resource URLs, nest related resources, and add filtering, sorting and capped pagination with the query string.

  5. HTTP Status Codes and Error Handling

    Make every reply tell the truth: choose the right status code, stop hiding errors inside 200 OK, and send errors as Problem Details (RFC 9457).

  6. Request Validation and DTOs

    Stop bad data at the door: use request and response DTOs, block over-posting, validate every field, and return every error as a validation problem.

  7. Building a CRUD API

    Build create, read, update and delete endpoints for the menu and orders, guard status changes with 409, and move logic into services.

  8. API Documentation with OpenAPI

    Describe your API in an OpenAPI document, serve it from ASP.NET Core, and use it to list endpoints, lint the design, contract-test responses and generate clients.