Photos

Photos liées à un album.

5000 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
albumId integer Obligatoire Album existant, sinon 400
title string Obligatoire 255 caractères au maximum
url string Facultatif URL valide, 500 caractères au maximum
thumbnailUrl string Facultatif URL valide, 500 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

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

Exemples

Codes de retour : 200

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

Codes de retour : 200, 404

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

Codes de retour : 201, 400, 422

JAVASCRIPT
fetch('https://www.api-placeholder.frederickagathe.fr/api/photos', {
  method: 'POST',
  headers: { 'Content-type': 'application/json; charset=UTF-8' },
  body: JSON.stringify({
    "albumId": 1,
    "title": "Ma photo",
    "url": "https://exemple.com/600.png",
    "thumbnailUrl": "https://exemple.com/150.png"
}),
})
  .then((response) => response.json())
  .then((json) => console.log(json));

Codes de retour : 200, 400, 404, 422

JAVASCRIPT
fetch('https://www.api-placeholder.frederickagathe.fr/api/photos/1', {
  method: 'PUT',
  headers: { 'Content-type': 'application/json; charset=UTF-8' },
  body: JSON.stringify({
    "albumId": 1,
    "title": "Ma photo",
    "url": "https://exemple.com/600.png",
    "thumbnailUrl": "https://exemple.com/150.png"
}),
})
  .then((response) => response.json())
  .then((json) => console.log(json));

Codes de retour : 200, 400, 404, 422

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

Codes de retour : 204

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