Name: Towards AI Legal Name: Towards AI, Inc. Description: Towards AI is the world's leading artificial intelligence (AI) and technology publication. Read by thought-leaders and decision-makers around the world. Phone Number: +1-650-246-9381 Email: pub@towardsai.net
228 Park Avenue South New York, NY 10003 United States
Website: Publisher: https://towardsai.net/#publisher Diversity Policy: https://towardsai.net/about Ethics Policy: https://towardsai.net/about Masthead: https://towardsai.net/about
Name: Towards AI Legal Name: Towards AI, Inc. Description: Towards AI is the world's leading artificial intelligence (AI) and technology publication. Founders: Roberto Iriondo, , Job Title: Co-founder and Advisor Works for: Towards AI, Inc. Follow Roberto: X, LinkedIn, GitHub, Google Scholar, Towards AI Profile, Medium, ML@CMU, FreeCodeCamp, Crunchbase, Bloomberg, Roberto Iriondo, Generative AI Lab, Generative AI Lab VeloxTrend Ultrarix Capital Partners Denis Piffaretti, Job Title: Co-founder Works for: Towards AI, Inc. Louie Peters, Job Title: Co-founder Works for: Towards AI, Inc. Louis-François Bouchard, Job Title: Co-founder Works for: Towards AI, Inc. Cover:
Towards AI Cover
Logo:
Towards AI Logo
Areas Served: Worldwide Alternate Name: Towards AI, Inc. Alternate Name: Towards AI Co. Alternate Name: towards ai Alternate Name: towardsai Alternate Name: towards.ai Alternate Name: tai Alternate Name: toward ai Alternate Name: toward.ai Alternate Name: Towards AI, Inc. Alternate Name: towardsai.net Alternate Name: pub.towardsai.net
5 stars – based on 497 reviews

Frequently Used, Contextual References

TODO: Remember to copy unique IDs whenever it needs used. i.e., URL: 304b2e42315e

Resources

Free: 6-day Agentic AI Engineering Email Guide.
Learnings from Towards AI's hands-on work with real clients.
HTTP Method :The Actions Behind Every API Call
Latest   Machine Learning

HTTP Method :The Actions Behind Every API Call

Last Updated on July 27, 2026 by Editorial Team

Author(s): Code X

Originally published on Towards AI.

HTTP Method :The Actions Behind Every API Call

How does your app tell an API what action to do ? Types of HTTP Method ? Classification of HTTP Methods?

In this series we will go through HTTP Method, its types and classification. When you think of an API, it normal to just image that it works just by telling it where to go. But I’m here to tell you its not just the location it need’s but also the instruction of what to do when it reach the location. You need to think

When my app talks to an API, it needs to say what action it wants to perform. Not just where to go, but what to do when it gets there.

HTTP Method :The Actions Behind Every API Call

Introduction

HTTP Method is what tell an API which action to perform when it gets to a location specified by the API endpoint (URL endpoint of the API). Think of it like actions you’d perform on a document. There are 9 types of HTTP Methods, and 5 of them are used in API Development. Each will depend on what action the API will do. The four standard, most commonly used HTTP methods in API development are GET, POST, PUT, DELETE. The last method which is PATCH, is not always used in API development.

Key Terminology used in API and HTTP Discussion

Before we proceed to talk about the different types of HTTP methods, we should go through some common key terminology that will help you understand how each HTTP method works.

  • HTTP: Hypertext Transfer Protocol
  • API Request/API Call: This is a digital message sent by one software (the client) to another (the server) asking it to provide data , perform an task or update information. All of this (Endpoint, HTTP method, HTTP headers, body) makes up an API request.
Fig. 1 (API REQUEST/ API CALL)
  • Request Body/Request Content/Payload: All of this words means same thing in the world of API development and HTTP discussion. It means the data sent in an API call to the server.
  • Response: This is the server’s feedback. When a request is made, a response should be expected. As you well know, social communication is not complete without feedback given. The same applies in API communication. This response will look similar to the API request.
Fig. 2 (API Response)
  • Altering Server State: This means making a permanent change on the server. E.g modifing a database, updating a file, deleting a record, shutting down a background process on the server. Here the server’s condition is literally different after the request call is made, because of the action taken.

Types of HTTP Method

The 5 Main HTTP Methods used in API Development

  1. GET — “Give me data”
    Fetches/reads information from the server. It doesn’t change anything, just retrieves it. Note that it doesn’t contain request content (request body/payload)
  • Behavior: It should only fetch data and never modify server’s state. Request content(request body or payload) is not needed.
  • Real life example: Loading your Instagram feed, fetching a list of user profiles, loading a webpage.

2. POST — “Create something new”
Sends new data to the server to either create a resource or store the new data in the server.

  • Behavior: It contain request content/body which can be stored or used to alter server’s state(create new resource).
  • Real life example: Signing up for a new account, posting a new comment, submitting a registration form, a payment request.

3. PUT — “Update/replace this”
Replaces an existing piece of data entirely with new data.

  • Behavior: It replaces an existing piece of data entirely with new data contained in the request body.
  • Real life example: Editing your entire profile(name, email, age,…) at once

4. DELETE — “Remove this”
Deletes a specific piece of data/resource from the server.

  • Behavior: It deletes the resource identified by the URL route endpoint.
  • Real life example: Deleting a post or account, removing a photo.

5. PATCH — “Update just a part”
Updates/Modifies a specific part of an existing data, not the whole thing.

  • Behavior: It modifies a specific part of an existing data with new data contained in the request body.
  • Real life example: Changing just your profile picture, changing just a password instead of the whole log-in profile.

Infrastructure HTTP Methods

This HTTP methods are used behind the scenes by API. Developers rarely write custom logic for these methods, but APIs rely on them automatically.

  1. OPTIONS — “CORS Check” : Used by the web browsers to check server security permissions before sending data. This very important for Cross-Origin Resource Sharing (CORS) compliance.
  2. HEAD: This is identical to GET, but the server only returns the response headers without the actual data body(information like content length). It is highly useful for testing if a file exist or checking download sizes

Other HTTP Method

  1. TRACE: This echoes back the exact request received by the server. It is meant for network diagnostics but its widely disabled on production servers because it can expose sensitive token to hackers via Cross-Site Tracking attacks.
  2. CONNECT: This establishes a raw network tunnel to a server. Its typically used to set up secure HTTPS proxies. It operates at a network routing level rather than an application API level.
Fig. 3 (API Request examples of HTTP Methods)

Classification of HTTP Methods

HTTP methods can be categorized in these three terms : safety, cacheability and idempotency.

  • safety: Dose it modify server’s state? when it doesn’t modify server state it categorized as safe.
  • Cacheability: Can the data or response gotten in an API call be stored and reused to fulfill subsequent API requests/call. If it can be stored its cacheable.
  • Idempotency: Can an operation (API call/request) produce the same final effect or state, no matter how many times its called. If it produce the the same final effect its idempotent.

Below is the table which show the HTTP Method categorization.

Fig. 4 (Classification of HTTP method)

Note: POST and PATCH are cacheable when responses (Servers feedback) explicitly include freshness information and a matching Content-Location header.

And That’s a Wrap!

We just went through different types of HTTP methods used on the internet. We also talked about the different classifications of HTTP methods. With this information, you already know all the HTTP methods and their use cases on the internet. Below I will leave you a summary table to help you get by and remember these HTTP methods. In the next series we will talk about the HTTP status codes which were seen in Fig. 2.

Closure

I wanted to take a moment to thank you for reading until the end and for being a part of this community.

Become a Medium member

If you want to show some love, please take a moment before you go, to clap, drop a comment and follow the writer️!

If you want more content on this series check this Link

See you in the next one. 🚀

Join thousands of data leaders on the AI newsletter. Join over 80,000 subscribers and keep up to date with the latest developments in AI. From research to projects and ideas. If you are building an AI startup, an AI-related product, or a service, we invite you to consider becoming a sponsor.

Published via Towards AI


Towards AI Academy

We Build Enterprise-Grade AI. We'll Teach You to Master It Too.

15 engineers. 100,000+ students. Towards AI Academy teaches what actually survives production.

Start free — no commitment:

6-Day Agentic AI Engineering Email Guide — one practical lesson per day

Agents Architecture Cheatsheet — 3 years of architecture decisions in 6 pages

Our courses:

AI Engineering Certification — 90+ lessons from project selection to deployed product. The most comprehensive practical LLM course out there.

Agent Engineering Course — Hands on with production agent architectures, memory, routing, and eval frameworks — built from real enterprise engagements.

AI for Work — Understand, evaluate, and apply AI for complex work tasks.

Note: Article content contains the views of the contributing authors and not Towards AI.