📚Academy
likeone
online

What Is an API?

APIs are how machines talk to each other. Master this and you can connect anything to anything — the foundation of every automation you will ever build.

The Request / Response Cycle

Every API interaction follows one pattern: your code sends a request, the server processes it, and sends back a response.

💻
Client
Your Code
REQUEST
RESPONSE
☁️
Server
API Endpoint

What a Real API Request Looks Like

Here is an actual API request to get a list of users. Every part is labeled:

# The request: GET method, URL, headers
GET https://api.example.com/users?limit=10
Authorization: Bearer sk_live_abc123...
Content-Type: application/json
Accept: application/json
Method GET — what you want to do (read, create, update, delete)
URL Where to send it. ?limit=10 is a query parameter — filters the results.
Headers Metadata about your request. Authorization proves who you are. Content-Type says what format you are using.

HTTP Methods

There are four core HTTP methods. Each tells the server what operation to perform:

GET — Read data without modifying it. Example: GET /users returns a list of users. Safe and idempotent.
POST — Create a new resource. Sends a JSON body with the data. Example: POST /orders with {"product": "Pro Plan"} creates a new order. Returns 201 Created.
PUT — Update or replace an existing resource. Example: PUT /users/42 with updated fields replaces that user's data. Idempotent — same result if called multiple times.
DELETE — Remove a resource. Example: DELETE /users/42 removes the user with id 42. Usually returns 200 OK or 204 No Content.

Try It: cURL Examples

cURL is the universal command-line tool for making API requests. These are real commands you can run in your terminal:

# GET — Read a list of users
curl https://jsonplaceholder.typicode.com/users

# POST — Create a new post (with JSON body)
curl -X POST https://jsonplaceholder.typicode.com/posts \
  -H "Content-Type: application/json" \
  -d '{"title": "My Post", "body": "Hello world"}'

# DELETE — Remove a post
curl -X DELETE https://jsonplaceholder.typicode.com/posts/1

jsonplaceholder.typicode.com is a free fake API for learning. The data is not real, but the requests and responses work exactly like a production API. Try these in your terminal right now.

🔒

This lesson is for Pro members

Unlock all 520+ lessons across 52 courses with Academy Pro.

Already a member? Sign in to access your lessons.

Academy
Built with soul — likeone.ai