2023-03-26 21:25:55 +02:00
|
|
|
/*
|
|
|
|
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) {
|
2023-03-27 20:19:59 +02:00
|
|
|
let request = await fetch(`${PAPI.searchURL}&rows=0&sort=tri&facet=form_lib_voe_acc&refine.fili=${filiere}`)
|
2023-03-26 21:25:55 +02:00
|
|
|
let result = await request.json()
|
|
|
|
|
|
|
|
return result["facet_groups"][0]["facets"]
|
|
|
|
}
|
2023-03-28 00:48:55 +02:00
|
|
|
|
|
|
|
static async fetchSpecialites(specialite) {
|
|
|
|
let request = await fetch(`${PAPI.searchURL}&rows=0&sort=tri&facet=fil_lib_voe_acc&refine.form_lib_voe_acc=${specialite}`)
|
|
|
|
let result = await request.json()
|
|
|
|
|
|
|
|
return result["facet_groups"][0]["facets"]
|
|
|
|
}
|
2023-03-28 16:51:44 +02:00
|
|
|
|
|
|
|
static async fetchEtablissement(filiere, sousfiliere, soussousfiliere) {
|
|
|
|
let request = await fetch(`${PAPI.searchURL}&refine.fil_lib_voe_acc=${soussousfiliere}&refine.form_lib_voe_acc=${sousfiliere}&refine.fili=${filiere}`)
|
|
|
|
let result = await request.json()
|
|
|
|
console.log(result["records"])
|
|
|
|
return result["records"]
|
|
|
|
}
|
2023-03-26 21:25:55 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
export default PAPI
|