Skip to content
HTTP

Methods

Core HTTP request methods.

By EZ4Code Team
methodgetpost

Code

GET /api/users HTTP/1.1
Host: api.example.com
Accept: application/json

---

POST /api/users HTTP/1.1
Host: api.example.com
Content-Type: application/json

{"name":"Alice"}

---

DELETE /api/users/1 HTTP/1.1
Host: api.example.com

---

PUT /api/users/1 HTTP/1.1
Host: api.example.com
Content-Type: application/json

{"name":"Alice2"}

Explanation

HTTP methods convey the action to perform on a resource: GET reads, POST creates, PUT replaces, and DELETE removes. GET and HEAD are safe and cacheable, while POST is neither. The request line is followed by headers, a blank line, and an optional body whose length is declared by Content-Length or Transfer-Encoding.

More HTTP Snippets