Aller au contenu

Intégrer le widget Agora

Vous pouvez afficher les derniers votes d'un député sur votre site (blog, association, média) via une iframe ou en appelant l'API. Le widget affiche jusqu'à 5 scrutins par défaut, avec un lien « Voir sur Agora » vers la fiche complète.

Méthode 1 : iframe

Copiez le code ci-dessous en remplaçant ACTEUR_REF par l'identifiant du député (ex. PA842279). Vous pouvez obtenir cet identifiant depuis la fiche député sur Agora (URL du type /deputy/PA842279) ou via l'API GET /api/deputies.

<iframe
  title="Derniers votes - Député"
  src="https://agora.gouv.fm/embed/deputy/PA842279/votes"
  width="100%"
  height="320"
  frameborder="0"
  loading="lazy"
></iframe>

Paramètre optionnel : ?limit=10 pour afficher jusqu'à 10 votes (max 20). Exemple : .../votes?limit=10.

Méthode 2 : API seule

Pour un rendu personnalisé, appelez l'endpoint d'embed (CORS autorisé) et affichez les données vous-même :

GET https://votre-api.vercel.app/api/embed/deputy/PA842279/votes?limit=5

Réponse JSON : acteur_ref, acteur_nom, et un tableau votes (chaque vote : scrutin_id, scrutin_titre, date_scrutin, position). Voir l'API Agora pour la documentation complète.

Exemple en direct

Voici le widget « Derniers votes » pour un député, intégré dans cette page. Vous pouvez changer l'identifiant pour tester.

Aperçu du widget

Code à copier

<iframe
  title="Derniers votes - Député"
  src="https://agora-citoyens.fr
/embed/deputy/PA842279/votes"
  width="100%"
  height="320"
  frameborder="0"
  loading="lazy"
></iframe>