The document presents an overview of APIs, focusing on RESTful APIs and CRUD operations. It discusses the architecture, constraints, and principles of REST, alongside practical examples of API request methods and URL design principles. Additionally, it includes various references for further reading on API design and implementation.
Types of API -Web service APIs ● SOAP ● REST - Functions or routines in an OS - Object remoting APIs ● .NET ● CORBA - Library-based APIs - Class-based APIs (object oriented) ● Java API https://htree.plus
4.
What is RESTfulAPI? https://htree.plus REpresentational State Transfer
- Client-Server Architecture Separationof concerns. (UI - Data Storage) - Statelessness In Real Life :- Where does Kalpit live? What is his age? In REST :- Where does Kalpit live? What is Kalpit’s age? REST Architectural Constraints https://htree.plus
7.
- Cacheability Well-managed cachingpartially or completely eliminates some client-server interactions, further improving scalability and performance. REST Architectural Constraints (Cont..) https://htree.plus
8.
- Uniform interface ●Identification of Resources https://api.example.com/customers/12 ● Resource Representations ● Self-Descriptive Messages Content-Type: application/json ● HATEOAS (Hypermedia As The Engine Of Application State) REST Architectural Constraints (Cont..) https://htree.plus
9.
- Layered system -Code on demand (optional) REST Architectural Constraints (Cont..) https://htree.plus
- users -POST request - users/1 - GET request - users/1 - DELETE request - users/1 - PUT request APIs Example https://htree.plus - users/create- POST request - users/1/show- GET request - users/1/delete - POST request - users/1/edit- POST request Normal CRUD API RESTful CRUD API
12.
URL Design Principle -Use nouns and NOT the verbs - API should be /products NOT /getAllProducts - Use Plurals - API should be /products NOT /product - Versioning - API should be /v1/products or /v2/products - Use Pagination - /products?page=1 - Use Lowercases - API should be /products NOT /Products
13.
Untold Story ofREST https://htree.plus GET /users { "parameter1": "value1", "parameter2": "value2", "parameter3": "value3", "parameter4": "value4" } POST /users/searches OR POST /filters/users