This topic is important to me because I want to utilize API’s to create applications that involve a wide variety of data.
Regular Expressions. Tutorial for Regex. Regex 101. API Design Practices.
Most web applications use API’s that clients can use.
A good design practice for these should aim to: Platform independence - Any client should be able to call the API no matter how the API is implemented.
Service evolution- It should be able to evolve and add functionality independently from client applications.
REST - Proposed by Roy Fielding, its an architectural style for building distributed systems based on hypermedia.
REST isn’t bound by specific implementations for API’s, allowing variety in use.
REST Api’s are designed around resources.
A resource has an identifier, which is a unique to that resource. Ex. www.google.com/order/1
Clients interact with a service by exchanging representations of resources. Many use JSON.
Rest api’s use HTTP verb to perform operations on resources.
The API design should be around the business entities. For example, they should be based on nouns(the resources) and not verbs(our operations.)
Try to limit your API being ‘chatty’, where your API expose a large number of small resources.
An API like this would require to send multiple request to find all the data that it requires. With a single request, it can lower this.
API operations: You have GET, POST, PUT, PATCH, AND DELETE.
GET: GETS a representation of the resource at the specified endpoint. POST: Creates a new resource at the specified endpoint. PUT: Either creates or replaces the resource at the specified endpoint. PATCH: performs a partial update of a resource. DELETE: well, it removes at that specified endpoint.
I want to know how to apply each operation on a resource, while also receiving it to my frontend. I want to understand the best practices, so I can create perfect resources.