0% found this document useful (0 votes)
3 views

REST API

The document outlines the structure of a URL, including components such as protocol, domain, domain extension, path, and parameters. It details various HTTP request methods (GET, POST, PUT, PATCH, DELETE) and their respective functionalities for interacting with server resources. Additionally, it provides examples of how to use these methods for single and collection resources, along with expected HTTP status codes for each operation.

Uploaded by

unstable da
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

REST API

The document outlines the structure of a URL, including components such as protocol, domain, domain extension, path, and parameters. It details various HTTP request methods (GET, POST, PUT, PATCH, DELETE) and their respective functionalities for interacting with server resources. Additionally, it provides examples of how to use these methods for single and collection resources, along with expected HTTP status codes for each operation.

Uploaded by

unstable da
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 10

1.

Protocol
2. Domain
3. Domain Extension
4. Path
5. Parameter
• https:aiubtech.com/api/course?category=flutter&way=offline

Protocol
D- Path
Domain extention Parameter
API Request Method

• GET => Get Data from server


• POST => Send/Create post/Data To server
• PUT Update/Edit post/Data To server
• PATCH Update/Edit post/Data To server
• DELETE => Delete/Remove post/Data To server
HTTP GET
• http://www.appdomain.com/users
• http://www.appdomain.com/users?size=20&page=5
• http://www.appdomain.com/users/123
• http://www.appdomain.com/users/123/address
HTTP POST
• http://www.appdomain.com/users
• http://www.appdomain.com/users/123/accounts

• Note: Create Post with body


HTTP PUT

• http://www.appdomain.com/users/123
• http://www.appdomain.com/users/123/accounts/456
HTTP DELETE
• http://www.appdomain.com/users/123
• http://www.appdomain.com/users/123/accounts/456
Single Resouce (e.g.
HTTP Method CRUD Collection Resource (e.g. /users)
/users/123)

201 (Created), ‘Location’ header with link to Avoid using POST on a


POST Create
/users/{id} containing new ID single resource

200 (OK), single user. 404


200 (OK), list of users. Use pagination, sorting,
GET Read (Not Found), if ID not
and filtering to navigate big lists
found or invalid

200 (OK) or 204 (No


405 (Method not allowed), unless you want to
Content). Use 404 (Not
PUT Update/Replace update every resource in the entire collection
Found), if ID is not found
of resource
or invalid

200 (OK) or 204 (No


Partial 405 (Method not allowed), unless you want to Content). Use 404 (Not
PATCH
Update/Modify modify the collection itself Found), if ID is not found
or invalid

200 (OK). 404 (Not


405 (Method not allowed), unless you want to
DELETE Delete Found), if ID not found or
delete the whole collection — use with caution
inva

You might also like