Lecture

What are HTTP Methods?

HTTP Methods inform the server about the type of action the client wants to perform.

Common methods include GET, POST, PUT, PATCH, and DELETE, each requesting a different operation from the server.


GET Method

Requests a specified resource from the server. GET requests are used to retrieve data and do not change the state of the server.

  • Example: When a URL is entered into a web browser's address bar, the browser makes a GET request to display the page.

POST Method

Sends data to the server to create or update a resource.

  • Example: Data is sent via the POST method when submitting forms or uploading files.

PUT Method

Replaces a specified resource with the requested data. It updates an existing resource or creates a new one if no resource exists at the given URI.

  • Example: A PUT request can be used to update user profile information.

PATCH Method

Performs a partial update on a resource. While PUT replaces the entire resource, PATCH modifies only a part.

  • Example: Use a PATCH request to update a specific field (e.g., nickname) in a user profile.

DELETE Method

Deletes a specified resource.

  • Example: DELETE requests are used to remove uploaded posts or delete user accounts.

HTTP Status Codes

HTTP Status Codes are codes comprised of three digits that inform the client about how their request was handled by the server.


Major HTTP Status Codes

  • 200 OK: The request was successfully processed.

  • 201 Created: A POST request was successfully processed and a new resource was created.

  • 400 Bad Request: The server did not understand the request.

  • 401 Unauthorized: The request requires authentication.

  • 403 Forbidden: The server refused to fulfill the request.

  • 404 Not Found: The requested resource cannot be found.

  • 500 Internal Server Error: An internal server error occurred.


Practice

Click the Run Code button on the right side of the screen to check the crawling results or modify the code!

Lecture

AI Tutor

Publish

Design

Upload

Notes

Favorites

Help

Code Editor

Run
Generate

Execution Result