Library › Software development

Free guide

REST APIs for Beginners

How applications talk to each other. A REST API allows one application to communicate with another over HTTP. For example: Mobile App ↓ REST API ↓ Backend ↓ Database

1 min readFor developers, students and beginners and project managers

How applications talk to each other.

A REST API allows one application to communicate with another over HTTP.

For example:

Mobile App
    ↓
 REST API
    ↓
Backend
    ↓
Database

1. The Four HTTP Methods

GET — Read

GET /users

Get users.

POST — Create

POST /users

Create a user.

PUT — Replace

PUT /users/10

Replace user 10.

DELETE — Delete

DELETE /users/10

Delete user 10.


2. URLs

An API might look like:

https://api.example.com/users

Specific resource:

https://api.example.com/users/10

The 10 identifies the resource.


3. Query Parameters

Useful for filtering or searching:

/users?status=active

Multiple parameters:

/users?status=active&page=2

4. JSON

Most modern REST APIs exchange data using JSON.

Request:

{
  "name": "Jacob",
  "email": "jacob@example.com"
}

Response:

{
  "id": 10,
  "name": "Jacob",
  "email": "jacob@example.com"
}

5. Common HTTP Status Codes

CodeMeaning
200Success
201Created
204Success, no content
400Bad request
401Not authenticated
403Not allowed
404Not found
500Server error

The ones you'll constantly encounter are:

200, 201, 400, 401, 403, 404, 500


6. Test an API with curl

GET:

curl https://api.example.com/users

POST:

curl -X POST https://api.example.com/users \
  -H "Content-Type: application/json" \
  -d '{"name":"Jacob"}'

You can also use tools such as Postman or Insomnia.


7. Authentication

APIs often require a token.

For example:

Authorization: Bearer YOUR_TOKEN

Never commit API keys or tokens to Git.


The Essentials

Remember:

GET     → Read
POST    → Create
PUT     → Update/Replace
DELETE  → Delete

And:

Request → API → Response

That's REST.