Albums

Albums photos liés à un utilisateur.

100 entrées initiales

Tester

Méthode
Réponse
…

Champs

Champ Type POST et PUT Règle
id integer Généré Généré par l'API
userId integer Obligatoire Utilisateur existant, sinon 400
title string Obligatoire 255 caractères au maximum

PATCH ne valide que les champs envoyés. Les données initiales ne sont jamais modifiées : la réponse montre seulement le résultat simulé. DELETE répond toujours 204 sans rien supprimer.

Filtres

userId, title, à combiner avec _start et _limit. Exemple : /api/albums?userId=1&_limit=5.

Routes imbriquées

  • GET /api/albums/{id}/photos : Photos de l'album

Exemples

Codes de retour : 200

JAVASCRIPT
fetch('https://api-placeholder.frederickagathe.fr/api/albums?_limit=10')
  .then((response) => response.json())
  .then((json) => console.log(json));

Codes de retour : 200, 404

JAVASCRIPT
fetch('https://api-placeholder.frederickagathe.fr/api/albums/1')
  .then((response) => response.json())
  .then((json) => console.log(json));

Codes de retour : 201, 400, 422

JAVASCRIPT
fetch('https://api-placeholder.frederickagathe.fr/api/albums', {
  method: 'POST',
  headers: { 'Content-type': 'application/json; charset=UTF-8' },
  body: JSON.stringify({
    "userId": 1,
    "title": "Mon album"
}),
})
  .then((response) => response.json())
  .then((json) => console.log(json));

Codes de retour : 200, 400, 404, 422

JAVASCRIPT
fetch('https://api-placeholder.frederickagathe.fr/api/albums/1', {
  method: 'PUT',
  headers: { 'Content-type': 'application/json; charset=UTF-8' },
  body: JSON.stringify({
    "userId": 1,
    "title": "Mon album"
}),
})
  .then((response) => response.json())
  .then((json) => console.log(json));

Codes de retour : 200, 400, 404, 422

JAVASCRIPT
fetch('https://api-placeholder.frederickagathe.fr/api/albums/1', {
  method: 'PATCH',
  headers: { 'Content-type': 'application/json; charset=UTF-8' },
  body: JSON.stringify({
    "title": "Album renommé"
}),
})
  .then((response) => response.json())
  .then((json) => console.log(json));

Codes de retour : 204

JAVASCRIPT
fetch('https://api-placeholder.frederickagathe.fr/api/albums/1', { method: 'DELETE' })
  .then((response) => console.log(response.status)); // 204, sans contenu