Hypercafé

API JSON

Hypercafé expose une API JSON en lecture seule. Ajoutez .json à la fin d'une URL pour obtenir la réponse en JSON.

Points d'accès

URLDescription
/.jsonFil des posts (paginé)
/.json?tri=jourTop du jour (tri : recents, jour, semaine, mois, annee, tout)
/.json?page=2Page suivante
/p/ID.jsonUn post avec ses commentaires
/u/USERNAME.jsonProfil utilisateur et ses posts

Exemples

Fil des posts

curl http://hypercafe.fr/.json
{
  "page": 1,
  "sort": "recents",
  "posts": [
    {
      "id": "aBcDeFg",
      "type": "link",
      "title": "Exemple de post",
      "author": "alice",
      "created_at": "2025-01-15T12:00:00+00:00",
      "likes": 3,
      "comments": 2,
      "url": "http://hypercafe.fr/p/aBcDeFg",
      "link_url": "https://example.com"
    }
  ]
}

Post avec commentaires

curl http://hypercafe.fr/p/aBcDeFg.json
{
  "id": "aBcDeFg",
  "type": "text",
  "title": "Mon post",
  "author": "alice",
  "created_at": "2025-01-15T12:00:00+00:00",
  "likes": 5,
  "url": "http://hypercafe.fr/p/aBcDeFg",
  "body": "Contenu du post...",
  "comments": [
    {
      "id": "xYzAbCd",
      "body": "Super post !",
      "author": "bob",
      "created_at": "2025-01-15T13:00:00+00:00",
      "likes": 1,
      "children": []
    }
  ]
}

Profil utilisateur

curl http://hypercafe.fr/u/alice.json
{
  "username": "alice",
  "created_at": "2024-06-01T00:00:00+00:00",
  "total": 42,
  "page": 1,
  "posts": [...]
}

Notes