reading-notes

Class 301.13

Notes

Readings

CRUD Basics

  1. Which HTTP method would you use to update a record through an API?

    PUT

  2. Which REST methods require an ID parameter?

    Update and Delete

Speed Coding: Building a CRUD API

  1. What’s the relationship between REST and CRUD?

    REST (Representational State Transfer) is an architectural style that provides a set of guidelines for building web services CRUD (Create, Read, Update, Delete) is a set of basic operations that can be performed on data RESTful APIs often implement CRUD operations to interact with resources over the web. In other words, RESTful APIs use HTTP methods (GET, POST, PUT, DELETE) to perform CRUD operations on resources.

  2. If you had to describe the process of creating a RESTful API in 5 steps, what would they be?
    1. Define the resources: Identify the data entities that your API will interact with. These could be objects, records, or any other data structure.
  1. Design the endpoints: Determine the URLs (endpoints) that will be used to access and manipulate the resources. Each endpoint should correspond to a specific CRUD operation (Create, Read, Update, Delete).
  1. Implement the HTTP methods: Map the CRUD operations to the appropriate HTTP methods. Typically, POST is used for creating resources, GET for reading resources, PUT for updating resources, and DELETE for deleting resources.
  1. Handle the requests: Implement the logic to handle the incoming requests to the API endpoints. This involves processing the request parameters, validating the data, and performing the necessary operations on the resources.
  1. Return the responses: Generate and return the appropriate responses based on the outcome of the request. This may include returning the requested resource, a success message, or an error message with the appropriate HTTP status codes.

Things I want to learn more about

References