Vous regardez une version antérieure (v. /wiki/spaces/ESUPMULTI/pages/1425801229/Connecteur+CMS+Headless) de cette page.
afficher les différences
afficher l'historique de la page
« Afficher la version précédente
Vous regardez la version actuelle de cette page. (v. 7)
afficher la version suivante »
Paramétrage
Le connecteur CMS a été pensé de manière à pouvoir s'interfacer avec plusieurs CMS. Actuellement, 2 modules permettent de communiquer avec Wordpress et Directus.
La configuration du CMS qui sera utilisé se fait au niveau du fichier .env
# CMS TO USE : directus | wordpress
DEFAULT_CMS=
# DIRECTUS
#DIRECTUS_API_URL=xxx
#DIRECTUS_API_TOKEN=xxx
# WORDPRESS
#WORDPRESS_API_URL=xxx
#WORDPRESS_API_USERNAME=xxx
#WORDPRESS_API_PASSWORD=xxx
Dans DEFAULT_CMS indiquez le CMS souhaité, puis dé-commentez les lignes de conf propres au CMS choisi.
Collections et leurs champs disponibles
Channels
query {
channels {
id
code
color
icon
routerLink
filterable
translations {
languagesCode
label
}
}
}
query {
channel(id: "1") {
id
code
color
icon
routerLink
filterable
translations {
languagesCode
label
}
}
}
{
"data": {
"channel": {
"id": "1",
"code": "ALERT",
"color": "#EF154E",
"icon": null,
"routerLink": null,
"filterable": false,
"translations": [
{
"languagesCode": "en",
"label": "ALERT"
},
{
"languagesCode": "fr",
"label": "ALERTE"
}
]
}
}
}
query {
contactUs {
icon
to
translations {
languagesCode
title
content
}
}
}
{
"data": {
"contactUs": {
"icon": "mail",
"to": "test@test.com",
"translations": [
{
"languagesCode": "fr",
"title": "Nous contacter",
"content": "<p>On peut tromper 1000 fois 1 personne, mais on ne peut pas tromper 1000 fois 1000 personnes</p>"
},
{
"languagesCode": "en",
"title": "Contact us",
"content": "<p>You can fool 1 person 1000 times, but you can't fool 1000 people 1000 times</p>"
}
]
}
}
}
Features
query {
features {
id
description
translations {
languagesCode
title
shortTitle
searchKeywords
}
icon
iconSvgDark
iconSvgLight
menu
authorization {
roles
type
}
position
settingsByRole {
position
role
}
type
routerLink
link
ssoService
statisticName
}
}
query {
feature(id: "1") {
id
description
translations {
languagesCode
title
shortTitle
searchKeywords
}
icon
iconSvgDark
iconSvgLight
menu
authorization {
roles
type
}
position
settingsByRole {
position
role
}
type
routerLink
link
ssoService
statisticName
}
}
{
"data": {
"feature": {
"id": "1",
"description": "Redirige l'utilisateur vers le service interne affichant les dernières actualités",
"translations": [
{
"languagesCode": "fr",
"title": "L'actualité",
"shortTitle": null,
"searchKeywords": null
},
{
"languagesCode": "en",
"title": "News",
"shortTitle": null,
"searchKeywords": null
}
],
"icon": null,
"iconSvgDark": "<svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" xmlns=\"http://www.w3.org/2000/svg\">...</svg>",
"menu": "top",
"authorization": null,
"position": 10,
"settingsByRole": [
{
"position": 1,
"role": "student"
}
],
"type": "internal",
"routerLink": "/rss",
"link": null,
"ssoService": null,
"statisticName": "rss"
}
}
}
Important News
query {
importantNews {
id
translations {
languagesCode
title
content
buttonLabel
}
image
authorization {
roles
type
}
color
link
position
statisticName
}
}
query {
importantNew(id: "1") {
id
translations {
languagesCode
title
content
buttonLabel
}
image
authorization {
roles
type
}
color
link
position
statisticName
}
}
{
"data": {
"importantNew": {
"id": "1",
"translations": [
{
"languagesCode": "fr",
"title": "Cartes étudiant",
"content": "Vos cartes d'étudiant sont disponibles !",
"buttonLabel": "Voir vos cartes"
},
{
"languagesCode": "en",
"title": "Student cards",
"content": "Your student cards are available!",
"buttonLabel": "See your cards"
}
],
"image": "5a3695fc-af24-4c60-bd67-50eaee02d81e",
"authorization": {
"roles": [
"student"
],
"type": "ALLOW"
},
"color": "#EF154E",
"link": "/cards",
"position": null,
"statisticName": "cards"
}
}
}