Stage 1. HTTP Methods: GET, POST, PUT, DELETE

When a beginner sees an API for the first time, it may look like a random set of URLs. In reality, API communication follows a protocol. A protocol is simply a set of shared rules. The browser, mobile app, and server can work together only because they all understand the same rules.

In web development, the base protocol is HTTP. HTTP defines how a client sends a request and how a server sends a response back. The client can be a browser tab, a mobile app, or another backend service. The server receives the request, runs business logic, and returns a result.

HTTPS is the secure version of HTTP. The “S” means TLS encryption is used. With plain HTTP, traffic can be read or changed by someone in the middle of the network. With HTTPS, request and response data are encrypted in transit. For real products, login and personal data must go through HTTPS.

Client and server over HTTP/HTTPS

A request usually contains three beginner-level parts:

  • method (GET, POST, PUT, DELETE)
  • path (for example, /tasks)
  • optional body (data sent to the server)

The response usually contains:

  • status code (200, 201, 404, and so on)
  • optional response body

Now the key idea: HTTP method shows the intent of the operation.

Method Simple meaning Typical beginner use
GET Read data Load a page or list of items
POST Create data Add a new item
PUT Replace existing data Update an existing item fully
DELETE Remove data Delete an existing item

To make this practical, use one realistic scenario: a simple task list app.

A user opens the app and wants to see all tasks. The client sends GET /tasks. The server returns the current list. This operation should only read data, not change it.

Then the user creates a new task: “Buy milk”. The client sends POST /tasks with data in the body, for example task text. The server creates a new task record and returns the created task.

Later the user edits a task. The app already knows task id 7, so it sends PUT /tasks/7 with a new full state, for example updated text and completed flag. The server replaces the current stored state for this task.

Finally, the user removes a task and the app sends DELETE /tasks/7. The server deletes it and confirms success.

One frequent beginner mistake is using POST for everything. At first it works, but soon the API becomes hard to understand: every route looks like “do something”, and clients cannot predict behavior from protocol semantics.

Another mistake is changing data through GET. For example, if GET /tasks/7/complete marks a task as completed, then page refreshes, prefetching, or retries can trigger accidental state changes. GET should stay read-only.

You do not need advanced patterns at this stage. For now, remember a safe baseline:

  1. Need to read data: use GET.
  2. Need to create a new record: use POST.
  3. Need to replace an existing record by known id: use PUT.
  4. Need to remove a record: use DELETE.

If this mapping is consistent, your API is easier to read, easier to debug, and safer for beginners to extend. The main win is not “academic correctness”. The main win is predictable behavior for both developer and user.

Glossary
request
A message sent by a client to a server asking for an action or resource.
response
A message sent by a server back to a client after processing a request.
header
Metadata attached to an HTTP request or response.
body
The main payload of an HTTP request or response.
status code
A numeric HTTP result that tells whether a request succeeded, failed, or needs another action.
resource
A named thing exposed by an API, such as a user, order, file, or session.
serialization
Converting an object or data structure into a transferable format such as JSON.
deserialization
Converting transferred data such as JSON back into an object or data structure.
cookie
A small piece of data stored by the browser and sent with matching HTTP requests.
session
Server-side or logical state that represents a continuing interaction with a client.
same-origin policy
A browser security rule that restricts how pages from one origin can access another origin.
stateless
Describes a system where each request contains enough information to be processed independently.
stateful
Describes a system that keeps remembered state between requests.
idempotent
Describes an operation that has the same effect when repeated multiple times.
token
A compact value used in APIs to represent identity, permission, session state, or authorization data.