reading-notes

More CRUD

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

used to update a record through an API is typically PUT or PATCH.

Which REST methods require an ID parameter?

GET: Retrieve a resource or a collection of resources. POST: Create a new resource. PUT: Update an existing resource or replace it entirely. PATCH: Update an existing resource partially. DELETE: Delete a resource.

What’s the relationship between REST and CRUD?

CRUD stands for Create, Read, Update, and Delete, which are the four basic functions that can be performed on data.REST, on the other hand, stands for Representational State Transfer, which is a set of principles for designing web services

If you had to describe the process of creating a RESTful API in 5 steps, what would they be?

Define the resources: Identify the resources (e.g., users, orders, products, etc.) that you want to expose through your API. Define the endpoints: Define the URL endpoints for each resource, including the HTTP methods (e.g., GET, POST, PUT, DELETE) that can be used to interact with the resources. Define the data model: Define the data model for each resource, including the properties (e.g., name, age, address) that each resource should have and the data types (e.g., string, number, boolean) of those properties. Implement the endpoints: Write the code for each endpoint, using a framework or library that supports RESTful APIs (e.g., Express.js, Django, Flask). Test the API: Test each endpoint to ensure that it is working correctly, using a tool such as Postman or cURL to send requests to the API and verify the responses.