Documentation
oEmbed
Elupedia expose un endpoint oEmbed 1.0 permettant aux CMS (WordPress, Ghost, Notion…) de transformer automatiquement un lien collé en carte riche.
Endpoint
GET https://www.elupedia.fr/api/oembed?url=URL&format=jsonParamètres
| Paramètre | Requis | Description |
|---|---|---|
url | Oui | URL de la page Elupedia à intégrer |
format | Non | json (défaut) ou xml |
URLs supportées
https://www.elupedia.fr/elus/{slug}— Fiche d'un éluhttps://www.elupedia.fr/scrutins/{id}— Fiche d'un scrutin
Exemple de requête
curl "https://www.elupedia.fr/api/oembed?url=https%3A%2F%2Fwww.elupedia.fr%2Felus%2Fmanuel-bompard&format=json"Réponse JSON
{
"type": "rich",
"version": "1.0",
"title": "Manuel Bompard — Député — 4e circ. Bouches-du-Rhône",
"author_name": "Manuel Bompard",
"provider_name": "Elupedia",
"provider_url": "https://www.elupedia.fr",
"thumbnail_url": "https://www.elupedia.fr/api/og/official/manuel-bompard.png",
"thumbnail_width": 1200,
"thumbnail_height": 630,
"html": "<iframe src=\"https://www.elupedia.fr/elus/manuel-bompard/embed\" width=\"500\" height=\"140\" frameborder=\"0\" style=\"border:0;border-radius:12px;overflow:hidden\" scrolling=\"no\"></iframe>",
"width": 500,
"height": 140
}Découverte automatique
Les pages de fiches d'élus et de scrutins incluent une balise <link> de découverte oEmbed dans leur <head> :
<link
rel="alternate"
type="application/json+oembed"
href="https://www.elupedia.fr/api/oembed?url=...&format=json"
title="..." />Les CMS compatibles (WordPress, Ghost, etc.) détectent automatiquement cette balise et génèrent un aperçu riche lorsqu'un utilisateur colle un lien Elupedia.
CORS
L'endpoint autorise les requêtes cross-origin depuis n'importe quel domaine (Access-Control-Allow-Origin: *).
Codes de retour
| Code | Signification |
|---|---|
200 | Réponse oEmbed réussie |
400 | Paramètre url manquant |
404 | URL non supportée ou ressource introuvable |
501 | Format non supporté |