Skip to content

Albums

The Albums resource represents photo albums created by users. Each album belongs to a user and can contain multiple photos.

Base URL

bash
https://api.jsonplaceholder.dev
bash
http://localhost:3000

Schema

typescript
interface Album {
  id: number
  userId: number
  title: string
}

Endpoints

Get All Albums

bash
GET /albums

Response:

json
[
  {
    "userId": 1,
    "id": 1,
    "title": "quidem molestiae enim"
  }
  // ... 99 more albums
]

Get Albums by User

bash
GET /albums?userId={userId}

Parameters:

  • userId (number, query) - Filter albums by user ID

Response:

json
[
  {
    "userId": 1,
    "id": 1,
    "title": "quidem molestiae enim"
  }
  // ... more albums by user 1
]

Get Single Album

bash
GET /albums/{id}

Parameters:

  • id (number) - Album ID

Response:

json
{
  "userId": 1,
  "id": 1,
  "title": "quidem molestiae enim"
}

Get Album Photos

bash
GET /albums/{id}/photos

Parameters:

  • id (number) - Album ID

Response:

json
[
  {
    "albumId": 1,
    "id": 1,
    "title": "accusamus beatae ad facilis cum similique qui sunt",
    "url": "https://via.placeholder.com/600/92c952",
    "thumbnailUrl": "https://via.placeholder.com/150/92c952"
  }
  // ... more photos in this album
]

Create Album

bash
POST /albums

Request Body:

json
{
  "userId": 1,
  "title": "My Photo Album"
}

Response: 201 Created

json
{
  "id": 101,
  "userId": 1,
  "title": "My Photo Album"
}

Update Album (Full Replace)

bash
PUT /albums/{id}

Parameters:

  • id (number) - Album ID

Request Body:

json
{
  "userId": 1,
  "title": "Updated Album Title"
}

Response: 200 OK

json
{
  "id": 1,
  "userId": 1,
  "title": "Updated Album Title"
}

Update Album (Partial)

bash
PATCH /albums/{id}

Parameters:

  • id (number) - Album ID

Request Body: Partial album object

json
{
  "title": "New Album Name"
}

Response: 200 OK - Updated album object

Delete Album

bash
DELETE /albums/{id}

Parameters:

  • id (number) - Album ID

Response: 200 OK

json
{}

Examples

javascript
// Get all albums
const albums = await fetch('http://localhost:3000/albums')
  .then(res => res.json());

// Get albums by user
const userAlbums = await fetch('http://localhost:3000/albums?userId=1')
  .then(res => res.json());

// Get album photos
const photos = await fetch('http://localhost:3000/albums/1/photos')
  .then(res => res.json());

// Create new album
const newAlbum = await fetch('http://localhost:3000/albums', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    userId: 1,
    title: 'Vacation Photos 2025'
  })
}).then(res => res.json());

// Update album
const updatedAlbum = await fetch('http://localhost:3000/albums/1', {
  method: 'PATCH',
  headers: {
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    title: 'Summer Vacation 2025'
  })
}).then(res => res.json());
bash
# Get all albums
curl http://localhost:3000/albums

# Get albums by user
curl http://localhost:3000/albums?userId=1

# Get album photos
curl http://localhost:3000/albums/1/photos

# Create new album
curl -X POST http://localhost:3000/albums \
  -H "Content-Type: application/json" \
  -d '{
    "userId": 1,
    "title": "Vacation Photos 2025"
  }'

# Update album
curl -X PATCH http://localhost:3000/albums/1 \
  -H "Content-Type: application/json" \
  -d '{"title": "Summer Vacation 2025"}'

# Delete album
curl -X DELETE http://localhost:3000/albums/1
python
import requests

# Get all albums
albums = requests.get('http://localhost:3000/albums').json()

# Get albums by user
user_albums = requests.get('http://localhost:3000/albums?userId=1').json()

# Get album photos
photos = requests.get('http://localhost:3000/albums/1/photos').json()

# Create new album
new_album = requests.post('http://localhost:3000/albums', json={
    'userId': 1,
    'title': 'Vacation Photos 2025'
}).json()

# Update album
updated_album = requests.patch('http://localhost:3000/albums/1', json={
    'title': 'Summer Vacation 2025'
}).json()

# Delete album
requests.delete('http://localhost:3000/albums/1')
  • Users - The owner of the album
  • Photos - Photos contained in the album

Fast Fake REST API powered by Bun + Elysia.js | Documentation site source: github.com/ckissi/jsonplaceholder