From afba3c0abc9c8136b7ec7b1aa8fd148fa211acad Mon Sep 17 00:00:00 2001 From: horville Date: Sun, 26 Mar 2023 21:25:55 +0200 Subject: [PATCH] PAPI v0.1 --- javascript/parcoursup-link.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 javascript/parcoursup-link.js diff --git a/javascript/parcoursup-link.js b/javascript/parcoursup-link.js new file mode 100644 index 0000000..1dd04b4 --- /dev/null +++ b/javascript/parcoursup-link.js @@ -0,0 +1,27 @@ +/* + Parcoursup API (PAPI) + Comprend un set de wrapper afin d'accéder plus aisément aux informations de l'API parcoursup +*/ + +class PAPI { + + static dataset = "fr-esr-parcoursup" + static timezone = "Europe%2FBerlin" + static searchURL = `https://data.enseignementsup-recherche.gouv.fr/api/records/1.0/search/?dataset=${PAPI.dataset}&timezone=${PAPI.timezone}` + + static async fetchFilieres() { + let request = await fetch(`${PAPI.searchURL}&rows=0&sort=tri&facet=fili`) + let result = await request.json() + + return result["facet_groups"][0]["facets"] + } + + static async fetchFiliere(filiere) { + let request = await fetch(`${PAPI.searchURL}&rows=0&sort=tri&facet=lib_for_voe_ins&refine.fili=${filiere}`) + let result = await request.json() + + return result["facet_groups"][0]["facets"] + } +} + +export default PAPI \ No newline at end of file