API Progression
Point d’entrée
| Méthode | URL | Description | Paramètres | Réponse |
|---|---|---|---|---|
| GET | / |
Configuration du serveur | Config |
Liens :
| Nom | Description |
|---|---|
| inscription | Inscription d’un utilisateur |
Authentification
Trois méthodes permettent l’authentification pour n’importe quelle requête :
Identifiant et mot de passe
Dans l’entête
Authorization, méthodeBasic, les paramètres suivants séparés par des deux-points (:) et encodés en base64Paramètre Description Type Défaut identifiant Nom d’utilisateur ou courriel str password Mot de passe str domaine Domaine LDAP str « » Exemple :
Authorization: Basic Ym9iOnBhc3N3b3JkOmV4ZW1wbGUuY29tIdentifiant et clé d’accès
Dans l’entête
Authorization, méthodeKey, les paramètres suivants séparés par des deux-points (:) et encodés en base64Paramètre Description Type Défaut identifiant Nom d’utilisateur ou courriel str key_name Identifiant de la clé Clé key_secret Secret correspondant à la clé str La clé nommée par
key_namedoit exister avec la portée «auth». Le secret peut alternativement être passé via cookie sécurisé.Token JWT
Dans l’entête
Authorization, un Token d’identification «au porteur» :Authorization: Bearer <token JWT>L’authentification par token ne permet pas de générer un token d’identification ni une clé d’authentification.
Autorisation
L’autorisation d’accéder aux ressources est donnée par un Token dans l’entête Authorization ou dans le paramètre tkres :
| Paramètre | Description | Type | Défaut |
|---|---|---|---|
| identifiant | Nom d’utilisateur ou courriel | str | |
| tkres | Token d’accès | Token |
Ressources
Les ressources échangées sont représentées en format JSON-API
Avancement
L’avancement d’un utilisateur pour une question.
Identifiant :
username/question_uri
Propriétés :
| Nom | Type | Valeurs | Description |
|---|---|---|---|
| état | str | « début » | Aucune tentative envoyée |
| « non_réussi » | Au moins une tentative, mais aucune n’est réussie | ||
| « réussi » | Au moins une tentative dont une réussie | ||
| titre | str | Le titre de la question tel qu’il était lors de la dernière tentative | |
| niveau | str | Le niveau de la question tel qu’il était lors de la dernière tentative | |
| date_modification | int | La date de la dernière tentative | |
| date_réussie | int | La date de la première tentative réussie | |
| extra | str | Infos extra à stoquer avec l’Avancement |
Relations :
| Nom | Cardinalité | Type | Description |
|---|---|---|---|
| tentatives | 1-n | Tentatives | liste de Tentatives effectuées |
Liens :
| Nom | Description |
|---|---|
| tentative | Soumettre une nouvelle tentative |
Clé
Une clé donnant accès à un sous-ensemble des services ou ressources de l’API. Les clés peuvent être octroyées temporairement ou être révoquées. Une clé peut être utilisée en lieu et place d’un mot de passe au moment d’effectuer une authentification. Le token JWT retourné après une authentification réussie peut être utilisé pour accéder aux services et ressources donnés par la portée de la clé.
Identifiant :
username/nom
Propriétés :
| Nom | Type | Valeurs | Description |
|---|---|---|---|
| secret | str | valeur secrète de la clé | |
| création | int | Timestamp de création | |
| expiration | int | Timestamp d’expiration, 0=n’expire jamais | |
| portée | str | Service ou ressource accessible par la clé. | |
| « révoquée » | La clé est révoquée pour tout service ou ressource | ||
| « auth » | La clé peut être utilisée pour authentifier l’utilisateur |
Config
Configuration du serveur
| Nom | Type | Valeurs | Description |
|---|---|---|---|
| config | dict | Dictionnaire de configurations | |
| version | str | Version actuelle du serveur |
Commentaire
Un message sur une tentative écrit par un utilisateur.
Identifiant :
username/question_uri/date_soumission/numéro
Propriétés:
| Nom | Type | Valeurs | Description | Défaut |
|---|---|---|---|---|
| message | str | |||
| créateur | str | nom d’utilisateur du créateur | Utilisateur authentifié | |
| date | int | timestamp de création | Date courante | |
| numéro_ligne | int | numéro de ligne où s’applique le commentaire |
Ébauche
Une ébauche de solution fournie comme point de départ à la résolution de l’exercice.
Identifiant :
question_uri/langage
Propriétés:
| Nom | Type | Valeurs | Description |
|---|---|---|---|
| langage | str | Langage de programmation de l’ébauche | |
| code | str | Code de l’ébauche |
Question
Une question générique.
Identifiant :
URI
Hiérarchie
Question ▲ ├ QuestionProg ├ QuestionSys └ QuestionBD
Propriétés :
| Nom | Type | Valeurs | Description |
|---|---|---|---|
| niveau | str | ||
| titre | str | ||
| description | str | ||
| objectif | str | ||
| énoncé | str ou liste de dict | ||
| auteur | str | ||
| licence | str | ||
| sous_type | str | questionProg | |
| questionSys | |||
| questionBD |
Question (sous-type QuestionProg)
Une question spécifiquement de programmation.
Relations :
| Nom | Cardinalité | Type | Description |
|---|---|---|---|
| ebauches | 1-n | Ébauche | liste d’ébauches de Solution |
| tests | 1-n | Test | liste de Tests de validation |
Question (sous-type QuestionSys)
Une question spécifiquement de type système
Relations :
| Nom | Cardinalité | Type | Description |
|---|---|---|---|
| image | 1 | str | image du conteneur |
| utilisateur | 1 | str | utilisateur du conteneur |
| solution | 1 | str | solution du test, s’il y a lieu |
| tests | 1-n | Test | liste de Tests de validation |
Résultat
Le résultat d’un test pour une solution proposée.
Identifiant :
username/question_uri/hash
Propriétés:
| Nom | Type | Valeurs | Description |
|---|---|---|---|
| sortie_observée | str | Sortie standard du Test | |
| sortie_erreur | str | Sortie d’erreur du Test | |
| résultat | bool | Vrai si le Test a été validé avec un code de retour de 0 et une sortie observée égale à la sortie attendue | |
| feedback | str | Rétroaction pour ce résultat de test | |
| temps_exécution | int | temps d’exécution en ms |
Sauvegarde automatique
La sauvegarde automatique du travail d’un utilisateur pour une question et dans un langage spécifique.
Identifiant :
username/question_uri/langage
Propriétés:
| Nom | Type | Valeurs |
|---|---|---|
| date_sauvegarde | int | timestamp |
| code | str |
Tentative
Une tentative de réponse à une question.
Identifiant :
username/question_uri/date_soumission
Hiérarchie
Tentative ▲ ├ TentativeProg ├ TentativeSys ├ TentativeBD
Propriétés :
| Nom | Type | Valeurs | Description |
|---|---|---|---|
| date_soumission | int | timestamp | |
| feedback | str | ||
| réussi | bool | vrai ssi la tentative a correctement répondu à la question | |
| temps_exécution | int | temps d’exécution en ms | |
| sous-type | str | tentativeProg | Sous-type de la ressource |
| tentativeSys | |||
| tentativeBD |
Relations :
| Nom | Cardinalité | Type | Description |
|---|---|---|---|
| résultats | 1-n | Résultat | les résultats de test |
Tentative (sous-type tentativeProg)
Une tentative de réponse à une QuestionProg.
Propriétés:
| Nom | Type | Valeurs | Description |
|---|---|---|---|
| langage | str | Langage de la tentative | |
| code | str | Code de la tentative | |
| tests_réussis | int | nb de tests réussis | |
| publique | bool | Vrai si une tentative réussie peut être partagée |
Tentative (sous-type tentativeSys)
Une tentative de réponse à une QuestionSys.
Propriétés:
| Nom | Type | Valeurs | Description |
|---|---|---|---|
| conteneur | str | identifiant du conteneur | |
| réponse | str | Réponse à une question à solution | |
| tests_réussis | int | nb de tests réussis |
Relations :
| Nom | Cardinalité | Type | Description |
|---|---|---|---|
| résultats | 1-n | Résultat | les résultats de test |
Test
Un test de validation d’une question auquel sont soumises les solutions proposées.
Identifiant :
question_uri/numéro
Propriétés :
| Nom | Type | Valeurs | Description |
|---|---|---|---|
| nom | str | ||
| sortie_attendue | str | La sortie attendue, ou null si sortie_cachée est vrai | |
| feedback_pos | str | ||
| feedback_neg | str | ||
| caché | bool | vrai si les entrées et sorties ont été caviardées |
TestProg (soustype de Test)
Un test de validation d’une QuestionProg auquel sont soumises les solutions proposées.
Propriétés :
| Nom | Type | Valeurs | Description |
|---|---|---|---|
| entrée | str | L’entrée du programme ou null si sortie_cachée est vrai | |
| params | str | Les paramètres du programme ou null si sortie_cachée est vrai | |
| feedback_err | str |
TestSys (soustype de Test)
Un test de validation d’une QuestionSys auquel sont soumises les solutions proposées.
Propriétés :
| Nom | Type | Valeurs | Description |
|---|---|---|---|
| validation | str | Script de validation | |
| utilisateur | str | l’utilisateur du conteneur |
Token
Un token JWT.
Types de tokens
Deux types de tokens peuvent être générés :
Propriétés :
| Nom | Type | Valeurs | Description |
|---|---|---|---|
| username | str | l’utilisateur propriétaire du token | |
| création | int | timestamp à la création | |
| expiration | int | timestamp d’expiration ou « +n » ou n est le nombre de secondes avant l’expiration | |
| data | any | données incluses dans le token | |
| ressources | [] | ressources permises par le «token ressources» | |
| jwt | str | token jwt signé | |
| fingerprint | str | empreinte (sha256) du contexte aléatoire du token fourni via un cookie sécurisé. | |
| version | int | version de l’api ayant généré le token |
- Data
data contient un objet peuplé de n’importes quelles données utiles au destinataire du token.
- Expiration
Lorsqu’on soumet un nouveau token, l’expiration peut être exprimée de façon absolue, sous forme de timestamp en secondes depuis 1/1/1970 (ex.: 1685831340) ou de façon relative en nombre de secondes après la création du token (ex.: « +300 »)
Une date d’expiration de 0 signifie que le token n’expire jamais.
- Ressources
Les ressources sont définies par leur URI et par la méthode de requête HTTP, avec une expression rationnelle. Un token ressource peut décrire une ou plusieurs ressources.
Relations
| Nom | Cardinalité | Type | Description |
|---|---|---|---|
| user | 1-1 | User | l’utilisateur pour lequel a été créé le token |
Utilisateur
Un utilisateur du système.
Identifiant :
username
Propriétés :
| Nom | Type | Valeurs | Description |
|---|---|---|---|
| username | str | ||
| courriel | str | ||
| état | str | « inactif », « actif », « en_attente_de_validation » | |
| rôle | str | « normal », « admin » | |
| préférences | str | chaîne JSON décrivant les préférences UI | |
| prénom | str | ||
| nom | str | ||
| nom_complet | str | ||
| pseudo | str | ||
| biographie | str | ||
| occupation | str | « étudiant », « enseignant », « tuteur », « autre » | |
| avatar | str |
Relations :
| Nom | Cardinalité | Type | description |
|---|---|---|---|
| avancements | 1-n | Avancement | Liste d’avancements |
| cles | 1-n | Clé | Liste de clés |
| tokens | 1-n | Token | Liste de tokens en écriture seule |
Exemples
Les exemples reflètent les résultats réels sur la plus récente version de l’API disponible sur https://progression.dti.crosemont.quebec/demo/api/v1/.
Obtenir la configuration du serveur
curl "https://progression.dti.crosemont.quebec/demo/api/v1//"
{
"data": {
"type": "config",
"id": "serveur",
"attributes": {
"version": "Progression 4.11.3()",
"config": {
"AUTH": {
"LDAP": false,
"LOCAL": false,
"OIDC": false
}
}
},
"links": {
"self": "https://progression.dti.crosemont.quebec/demo/api/v1/",
"inscrire": "https://progression.dti.crosemont.quebec/demo/api/v1/users"
}
}
}
Inscription en tant qu’utilisateur jdoe
DATA=$(cat <<EOF { "data": { "type": "user", "attributes": { "username": "jdoe" } } } EOF ) curl "https://progression.dti.crosemont.quebec/demo/api/v1//user/jdoe" -X PUT --data "$DATA" -H "Content-Type: application/json"
{
"data": {
"type": "user",
"id": "jdoe",
"attributes": {
"username": "jdoe",
"pseudonyme": "jdoe",
"occupation": "autre",
"avatar": "",
"biographie": "",
"nom": "",
"prénom": "",
"nom_complet": "",
"courriel": null,
"date_inscription": 1786683141,
"état": "actif",
"rôle": "normal",
"préférences": "",
"préférences_notifications": {}
},
"links": {
"self": "https://progression.dti.crosemont.quebec/demo/api/v1/user/jdoe",
"avancements": "https://progression.dti.crosemont.quebec/demo/api/v1/user/jdoe/avancements",
"clés": "https://progression.dti.crosemont.quebec/demo/api/v1/user/jdoe/cles",
"tokens": "https://progression.dti.crosemont.quebec/demo/api/v1/user/jdoe/tokens",
"banques": "https://progression.dti.crosemont.quebec/demo/api/v1/user/jdoe/banques",
"identités": "https://progression.dti.crosemont.quebec/demo/api/v1/user/jdoe/identites",
"déconnexion": "https://progression.dti.crosemont.quebec/demo/api/v1/logout"
},
"relationships": {
"avancements": {
"links": {
"self": "https://progression.dti.crosemont.quebec/demo/api/v1/user/jdoe/relationships/avancements",
"related": "https://progression.dti.crosemont.quebec/demo/api/v1/user/jdoe/avancements"
}
},
"cles": {
"links": {
"self": "https://progression.dti.crosemont.quebec/demo/api/v1/user/jdoe/relationships/cles",
"related": "https://progression.dti.crosemont.quebec/demo/api/v1/user/jdoe/cles"
}
},
"banques": {
"links": {
"self": "https://progression.dti.crosemont.quebec/demo/api/v1/user/jdoe/relationships/banques",
"related": "https://progression.dti.crosemont.quebec/demo/api/v1/user/jdoe/banques"
}
}
}
}
}
Obtenir un token pour jdoe
DATA=$(cat <<EOF { "data": { "type": "token", "attributes": { "ressources": { "tout": { "url": ".*", "method": ".*" } }, "expiration": "+30" } } } EOF )
curl "https://progression.dti.crosemont.quebec/demo/api/v1//user/jdoe/tokens" -H 'Authorization: basic amRvZTo=' --data "$DATA" -H "Content-Type: application/vnd.api+json"
{
"data": {
"type": "token",
"id": "riYuUb41Xne3B8UmCspVJPTNEWK-bevsM4BvLwC3LLw",
"attributes": {
"username": "jdoe",
"création": 1786683142,
"expiration": 1786683172,
"data": [],
"jwt": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VybmFtZSI6Impkb2UiLCJjdXJyZW50IjoxNzg2NjgzMTQyLCJleHBpcmVkIjoxNzg2NjgzMTcyLCJkYXRhIjpbXSwidmVyc2lvbiI6IjQuMTEuMyIsInJlc3NvdXJjZXMiOnsidG91dCI6eyJ1cmwiOiIuKiIsIm1ldGhvZCI6Ii4qIn19fQ.riYuUb41Xne3B8UmCspVJPTNEWK-bevsM4BvLwC3LLw",
"version": "4.11.3",
"ressources": {
"tout": {
"url": ".*",
"method": ".*"
}
}
},
"links": {
"self": "https://progression.dti.crosemont.quebec/demo/api/v1/token/riYuUb41Xne3B8UmCspVJPTNEWK-bevsM4BvLwC3LLw",
"user": "https://progression.dti.crosemont.quebec/demo/api/v1/user/jdoe"
}
}
}
Obtenir le profil de l’utilisateur authentifié jdoe
curl "https://progression.dti.crosemont.quebec/demo/api/v1//user/jdoe" -H "Authorization: Bearer $TOKEN"
{
"data": {
"type": "user",
"id": "jdoe",
"attributes": {
"username": "jdoe",
"pseudonyme": "jdoe",
"occupation": "autre",
"avatar": "",
"biographie": "",
"nom": "",
"prénom": "",
"nom_complet": "",
"courriel": null,
"date_inscription": 1786683141,
"état": "actif",
"rôle": "normal",
"préférences": "",
"préférences_notifications": {}
},
"links": {
"self": "https://progression.dti.crosemont.quebec/demo/api/v1/user/jdoe",
"avancements": "https://progression.dti.crosemont.quebec/demo/api/v1/user/jdoe/avancements",
"clés": "https://progression.dti.crosemont.quebec/demo/api/v1/user/jdoe/cles",
"tokens": "https://progression.dti.crosemont.quebec/demo/api/v1/user/jdoe/tokens",
"banques": "https://progression.dti.crosemont.quebec/demo/api/v1/user/jdoe/banques",
"identités": "https://progression.dti.crosemont.quebec/demo/api/v1/user/jdoe/identites",
"déconnexion": "https://progression.dti.crosemont.quebec/demo/api/v1/logout"
},
"relationships": {
"avancements": {
"links": {
"self": "https://progression.dti.crosemont.quebec/demo/api/v1/user/jdoe/relationships/avancements",
"related": "https://progression.dti.crosemont.quebec/demo/api/v1/user/jdoe/avancements"
}
},
"cles": {
"links": {
"self": "https://progression.dti.crosemont.quebec/demo/api/v1/user/jdoe/relationships/cles",
"related": "https://progression.dti.crosemont.quebec/demo/api/v1/user/jdoe/cles"
}
},
"banques": {
"links": {
"self": "https://progression.dti.crosemont.quebec/demo/api/v1/user/jdoe/relationships/banques",
"related": "https://progression.dti.crosemont.quebec/demo/api/v1/user/jdoe/banques"
}
}
}
}
}
Mettre à jour les préférences de jdoe
DATA=$(cat <<EOF { "data": { "type": "user", "attributes": { "préférences": "{\"thème\": \"sombre\"}" } } } EOF )
curl "https://progression.dti.crosemont.quebec/demo/api/v1//user/jdoe" -X PATCH --data "$DATA" -H "Content-Type: application/vnd.api+json" -H "Authorization: Bearer $TOKEN"
{
"data": {
"type": "user",
"id": "jdoe",
"attributes": {
"username": "jdoe",
"pseudonyme": "jdoe",
"occupation": "autre",
"avatar": "",
"biographie": "",
"nom": "",
"prénom": "",
"nom_complet": "",
"courriel": null,
"date_inscription": 1786683141,
"état": "actif",
"rôle": "normal",
"préférences": "{\"thème\": \"sombre\"}",
"préférences_notifications": {}
},
"links": {
"self": "https://progression.dti.crosemont.quebec/demo/api/v1/user/jdoe",
"avancements": "https://progression.dti.crosemont.quebec/demo/api/v1/user/jdoe/avancements",
"clés": "https://progression.dti.crosemont.quebec/demo/api/v1/user/jdoe/cles",
"tokens": "https://progression.dti.crosemont.quebec/demo/api/v1/user/jdoe/tokens",
"banques": "https://progression.dti.crosemont.quebec/demo/api/v1/user/jdoe/banques",
"identités": "https://progression.dti.crosemont.quebec/demo/api/v1/user/jdoe/identites",
"déconnexion": "https://progression.dti.crosemont.quebec/demo/api/v1/logout"
},
"relationships": {
"avancements": {
"links": {
"self": "https://progression.dti.crosemont.quebec/demo/api/v1/user/jdoe/relationships/avancements",
"related": "https://progression.dti.crosemont.quebec/demo/api/v1/user/jdoe/avancements"
}
},
"cles": {
"links": {
"self": "https://progression.dti.crosemont.quebec/demo/api/v1/user/jdoe/relationships/cles",
"related": "https://progression.dti.crosemont.quebec/demo/api/v1/user/jdoe/cles"
}
},
"banques": {
"links": {
"self": "https://progression.dti.crosemont.quebec/demo/api/v1/user/jdoe/relationships/banques",
"related": "https://progression.dti.crosemont.quebec/demo/api/v1/user/jdoe/banques"
}
}
}
}
}
Obtenir la question «Les fonctions avec paramètres/Rectangle» et ses tests:
Cette question est disponible à l’URL suivant : https://progression.pages.dti.crosemont.quebec/contenu/prog_1/9bdf5f1a-489a-441f-9e6e-2c87bba58bf8/info.yml
curl "https://progression.dti.crosemont.quebec/demo/api/v1//question/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw?include=tests" -H "Authorization: Bearer $TOKEN"
{
"data": {
"type": "question",
"id": "aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw",
"attributes": {
"niveau": "base",
"titre": "Grandeur Rectangle -2-",
"objectif": "Définir et utiliser des fonctions avec paramètres pour déterminer le périmètre et l'aire d'un rectangle",
"description": null,
"énoncé": "On souhaite déterminer le **périmètre** et l'**aire** d'un rectangle dont les côtés `largeur` et `longueur` sont reçus en entrée dans le programme principal.\n\nOn utilisera deux fonctions ayant chacune deux paramètres `périmètre(entier, entier)` et `aire(entier, entier)` pour déterminer et produire en sortie respectivement le **périmètre** et l'**aire** du rectangle.\n\nLa `largeur` et la `longueur` du rectangle sont **transmis en paramètres** aux fonctions.\n\n\n### Entrées\n\n- `largeur` : La largeur en mètre du rectangle (nombre entier)\n- `longueur` : La longueur en métre du rectangle (nombre entier)\n\n### Sorties attendues\n\nLe __périmètre__ et l'__aire__ du rectangle (nombres entiers)\n\n### À faire\n\nCompléter le code qui calcule et produit en sortie d'abord le __périmètre__ (en mètre) et ensuite l'__aire__ (en mètre carré) du rectangle,\n chacun sur une ligne et sans unités.\n\n### Exemples\n\n1. Périmètre et aire d'un petit rectangle\n\n - Entrées :\n```\n 1\n 1\n\n```\n\n - Sorties attendues :\n```\n 4\n 1\n\n```\n2. Périmètre et aire d'un rectangle\n\n - Entrées :\n```\n 10\n 20\n\n```\n\n - Sorties attendues :\n```\n 60\n 200\n\n```\n",
"auteur": "Wafaa Niar Dinedane / Patrick Lafrance",
"licence": "2021 CC-BY-SA",
"sous_type": "prog"
},
"links": {
"self": "https://progression.dti.crosemont.quebec/demo/api/v1/question/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw",
"résultats": "https://progression.dti.crosemont.quebec/demo/api/v1/question/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/resultats",
"avancement": "https://progression.dti.crosemont.quebec/demo/api/v1/avancement/jdoe/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw"
},
"relationships": {
"tests": {
"links": {
"self": "https://progression.dti.crosemont.quebec/demo/api/v1/question/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/relationships/tests",
"related": "https://progression.dti.crosemont.quebec/demo/api/v1/question/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/tests"
},
"data": [
{
"type": "test",
"id": "aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/0"
},
{
"type": "test",
"id": "aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/1"
},
{
"type": "test",
"id": "aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/2"
},
{
"type": "test",
"id": "aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/3"
}
]
},
"ebauches": {
"links": {
"self": "https://progression.dti.crosemont.quebec/demo/api/v1/question/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/relationships/ebauches",
"related": "https://progression.dti.crosemont.quebec/demo/api/v1/question/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/ebauches"
}
}
}
},
"included": [
{
"type": "test",
"id": "aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/0",
"attributes": {
"nom": "Petit rectangle",
"caché": false,
"sortie_attendue": "4\n1\n",
"entrée": "1\n1\n",
"params": ""
},
"links": {
"self": "https://progression.dti.crosemont.quebec/demo/api/v1/test/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/0",
"question": "https://progression.dti.crosemont.quebec/demo/api/v1/question/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw"
}
},
{
"type": "test",
"id": "aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/1",
"attributes": {
"nom": "Grand rectangle",
"caché": false,
"sortie_attendue": "600\n20000\n",
"entrée": "100\n200\n",
"params": ""
},
"links": {
"self": "https://progression.dti.crosemont.quebec/demo/api/v1/test/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/1",
"question": "https://progression.dti.crosemont.quebec/demo/api/v1/question/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw"
}
},
{
"type": "test",
"id": "aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/2",
"attributes": {
"nom": "Rectangle médium",
"caché": false,
"sortie_attendue": "80\n300\n",
"entrée": "10\n30\n",
"params": ""
},
"links": {
"self": "https://progression.dti.crosemont.quebec/demo/api/v1/test/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/2",
"question": "https://progression.dti.crosemont.quebec/demo/api/v1/question/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw"
}
},
{
"type": "test",
"id": "aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/3",
"attributes": {
"nom": "Rectangle nul",
"caché": false,
"sortie_attendue": "0\n0\n",
"entrée": "0\n0\n",
"params": ""
},
"links": {
"self": "https://progression.dti.crosemont.quebec/demo/api/v1/test/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/3",
"question": "https://progression.dti.crosemont.quebec/demo/api/v1/question/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw"
}
}
]
}
Obtenir la question «Les fonctions avec paramètres/Rectangle», ses tests et ses ébauches:
curl "https://progression.dti.crosemont.quebec/demo/api/v1//question/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw?include=tests,ebauches" -H "Authorization: Bearer $TOKEN"
{
"data": {
"type": "question",
"id": "aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw",
"attributes": {
"niveau": "base",
"titre": "Grandeur Rectangle -2-",
"objectif": "Définir et utiliser des fonctions avec paramètres pour déterminer le périmètre et l'aire d'un rectangle",
"description": null,
"énoncé": "On souhaite déterminer le **périmètre** et l'**aire** d'un rectangle dont les côtés `largeur` et `longueur` sont reçus en entrée dans le programme principal.\n\nOn utilisera deux fonctions ayant chacune deux paramètres `périmètre(entier, entier)` et `aire(entier, entier)` pour déterminer et produire en sortie respectivement le **périmètre** et l'**aire** du rectangle.\n\nLa `largeur` et la `longueur` du rectangle sont **transmis en paramètres** aux fonctions.\n\n\n### Entrées\n\n- `largeur` : La largeur en mètre du rectangle (nombre entier)\n- `longueur` : La longueur en métre du rectangle (nombre entier)\n\n### Sorties attendues\n\nLe __périmètre__ et l'__aire__ du rectangle (nombres entiers)\n\n### À faire\n\nCompléter le code qui calcule et produit en sortie d'abord le __périmètre__ (en mètre) et ensuite l'__aire__ (en mètre carré) du rectangle,\n chacun sur une ligne et sans unités.\n\n### Exemples\n\n1. Périmètre et aire d'un petit rectangle\n\n - Entrées :\n```\n 1\n 1\n\n```\n\n - Sorties attendues :\n```\n 4\n 1\n\n```\n2. Périmètre et aire d'un rectangle\n\n - Entrées :\n```\n 10\n 20\n\n```\n\n - Sorties attendues :\n```\n 60\n 200\n\n```\n",
"auteur": "Wafaa Niar Dinedane / Patrick Lafrance",
"licence": "2021 CC-BY-SA",
"sous_type": "prog"
},
"links": {
"self": "https://progression.dti.crosemont.quebec/demo/api/v1/question/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw",
"résultats": "https://progression.dti.crosemont.quebec/demo/api/v1/question/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/resultats",
"avancement": "https://progression.dti.crosemont.quebec/demo/api/v1/avancement/jdoe/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw"
},
"relationships": {
"tests": {
"links": {
"self": "https://progression.dti.crosemont.quebec/demo/api/v1/question/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/relationships/tests",
"related": "https://progression.dti.crosemont.quebec/demo/api/v1/question/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/tests"
},
"data": [
{
"type": "test",
"id": "aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/0"
},
{
"type": "test",
"id": "aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/1"
},
{
"type": "test",
"id": "aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/2"
},
{
"type": "test",
"id": "aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/3"
}
]
},
"ebauches": {
"links": {
"self": "https://progression.dti.crosemont.quebec/demo/api/v1/question/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/relationships/ebauches",
"related": "https://progression.dti.crosemont.quebec/demo/api/v1/question/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/ebauches"
},
"data": [
{
"type": "ebauche",
"id": "aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/python"
},
{
"type": "ebauche",
"id": "aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/java"
},
{
"type": "ebauche",
"id": "aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/kotlin"
}
]
}
}
},
"included": [
{
"type": "test",
"id": "aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/0",
"attributes": {
"nom": "Petit rectangle",
"caché": false,
"sortie_attendue": "4\n1\n",
"entrée": "1\n1\n",
"params": ""
},
"links": {
"self": "https://progression.dti.crosemont.quebec/demo/api/v1/test/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/0",
"question": "https://progression.dti.crosemont.quebec/demo/api/v1/question/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw"
}
},
{
"type": "test",
"id": "aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/1",
"attributes": {
"nom": "Grand rectangle",
"caché": false,
"sortie_attendue": "600\n20000\n",
"entrée": "100\n200\n",
"params": ""
},
"links": {
"self": "https://progression.dti.crosemont.quebec/demo/api/v1/test/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/1",
"question": "https://progression.dti.crosemont.quebec/demo/api/v1/question/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw"
}
},
{
"type": "test",
"id": "aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/2",
"attributes": {
"nom": "Rectangle médium",
"caché": false,
"sortie_attendue": "80\n300\n",
"entrée": "10\n30\n",
"params": ""
},
"links": {
"self": "https://progression.dti.crosemont.quebec/demo/api/v1/test/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/2",
"question": "https://progression.dti.crosemont.quebec/demo/api/v1/question/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw"
}
},
{
"type": "test",
"id": "aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/3",
"attributes": {
"nom": "Rectangle nul",
"caché": false,
"sortie_attendue": "0\n0\n",
"entrée": "0\n0\n",
"params": ""
},
"links": {
"self": "https://progression.dti.crosemont.quebec/demo/api/v1/test/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/3",
"question": "https://progression.dti.crosemont.quebec/demo/api/v1/question/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw"
}
},
{
"type": "ebauche",
"id": "aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/python",
"attributes": {
"langage": "python",
"code": "# Fonction qui calcule et produit en sortie le périmètre du rectangle dont les côtés sont reçus en paramètre. À faire\ndef périmètre( une_largeur, une_longueur ):\n # -TODO\n # -VISIBLE\n global compteur_appels\n compteur_appels += 1\n # +VISIBLE\n # +TODO\n\n\n# -TODO\n# Fonction qui calcule et produit en sortie l'aire du rectangle dont les côtés sont reçus en paramètre. À faire\n# +TODO\n\n\n\n# -TODO\n# Programme principal\n# -VISIBLE\ncompteur_appels = 0\n# +VISIBLE\n# Entrées\nlargeur = int( input() )\nlongueur = int( input() )\n\n# Appel des fonctions, les côtés du rectangle sont transmis en paramètre. À faire\npérimètre( largeur, longueur )\n# +TODO\n\n\n# -TODO\n# -VISIBLE\nif compteur_appels == 0:\n print( \"Incorrect: pas d'appel de fonction!\" )\n\n\n\n\n"
},
"links": {
"self": "https://progression.dti.crosemont.quebec/demo/api/v1/ebauche/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/python",
"question": "https://progression.dti.crosemont.quebec/demo/api/v1/question/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw"
}
},
{
"type": "ebauche",
"id": "aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/java",
"attributes": {
"langage": "java",
"code": "import java.util.Scanner;\nclass exec {\nstatic int compteurAppels = 0;\n// +VISIBLE\npublic static void main( String args[] ) {\n// -VISIBLE\nScanner sc = new Scanner( System.in );\n// +VISIBLE\n// Variables locales\n int largeur;\n int longueur;\n\n// Entrées\n largeur = sc.nextInt();\n longueur = sc.nextInt();\n // Appel des fonctions, les côtés du rectangle sont transmis en paramètre. À faire\n périmètre( largeur, longueur );\n // +TODO\n\n\n\n // -TODO\n // -VISIBLE\n if ( compteurAppels == 0 )\n System.out.println( \"Incorrect: pas d'appel de fonction!\" );\n // +VISIBLE\n}\n\n// Fonction qui calcule et produit en sortie le périmètre du rectangle dont les côtés sont reçus en paramètre. À faire\npublic static void périmètre( int uneLargeur, int uneLongueur ) {\n int résultat; // Variable locale\n // -VISIBLE\n compteurAppels++;\n // +VISIBLE\n // +TODO\n\n\n // -TODO\n}\n\n// Fonction qui calcule et produit en sortie l'aire du rectangle dont les côtés sont recus en paramètre. À faire\n// +TODO\n\n\n\n// -TODO\n// -VISIBLE\n}\n"
},
"links": {
"self": "https://progression.dti.crosemont.quebec/demo/api/v1/ebauche/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/java",
"question": "https://progression.dti.crosemont.quebec/demo/api/v1/question/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw"
}
},
{
"type": "ebauche",
"id": "aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/kotlin",
"attributes": {
"langage": "kotlin",
"code": "import java.util.Scanner\n\nvar compteurAppels = 0\n\n// +VISIBLE\nfun main() {\n\t// -VISIBLE\n var sc = Scanner(System.`in`)\n // +VISIBLE\n\t// Variables locales\n var largeur: Int\n var longueur: Int\n\n\t// Entrées\n largeur = sc.nextInt()\n longueur = sc.nextInt()\n // Appel des fonctions, les côtés du rectangle sont transmis en paramètre. À faire\n périmètre(largeur, longueur)\n // +TODO\n\n\n // -TODO\n // -VISIBLE\n if (compteurAppels == 0) println(\"Incorrect: pas d'appel de fonction!\")\n // +VISIBLE\n} // fin du main\n\n// Fonction qui calcule et produit en sortie le périmètre du rectangle dont les côtés sont reçus en paramètre. À faire\nfun périmètre(uneLargeur: Int, uneLongueur: Int) {\n var résultat: Int // Variable locale\n // -VISIBLE\n compteurAppels++\n // +VISIBLE\n // +TODO\n\n\n // -TODO\n} // fin de la fonction périmètre\n// Fonction qui calcule et produit en sortie l'aire du rectangle dont les côtés sont recus en paramètre. À faire\n// +TODO\n// -TODO\n// -VISIBLE\n"
},
"links": {
"self": "https://progression.dti.crosemont.quebec/demo/api/v1/ebauche/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/kotlin",
"question": "https://progression.dti.crosemont.quebec/demo/api/v1/question/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw"
}
}
]
}
Créer l’avancement de jdoe à la question «Les fonctions avec paramètres/Rectangle»
DATA=$(cat <<EOF { "data": { "type": "avancement", "id":"jdoe/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw" } } EOF )
curl --data "$DATA" https://progression.dti.crosemont.quebec/demo/api/v1//user/jdoe/avancements -H "Content-Type: application/vnd.api+json" -H "Authorization: Bearer $TOKEN"
{
"data": {
"type": "avancement",
"id": "jdoe/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw",
"attributes": {
"titre": "Grandeur Rectangle -2-",
"niveau": "base",
"état": "début",
"date_modification": null,
"date_réussite": null,
"extra": null
},
"links": {
"self": "https://progression.dti.crosemont.quebec/demo/api/v1/avancement/jdoe/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw",
"user": "https://progression.dti.crosemont.quebec/demo/api/v1/user/jdoe",
"question": "https://progression.dti.crosemont.quebec/demo/api/v1/question/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw",
"soumettre": "https://progression.dti.crosemont.quebec/demo/api/v1/avancement/jdoe/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/tentatives"
},
"relationships": {
"tentatives": {
"links": {
"self": "https://progression.dti.crosemont.quebec/demo/api/v1/avancement/jdoe/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/relationships/tentatives",
"related": "https://progression.dti.crosemont.quebec/demo/api/v1/avancement/jdoe/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/tentatives"
}
},
"sauvegardes": {
"links": {
"self": "https://progression.dti.crosemont.quebec/demo/api/v1/avancement/jdoe/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/relationships/sauvegardes",
"related": "https://progression.dti.crosemont.quebec/demo/api/v1/avancement/jdoe/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/sauvegardes"
}
}
}
}
}
Obtenir l’avancement de jdoe pour la question «Les fonctions avec paramètres/Rectangle»
curl "https://progression.dti.crosemont.quebec/demo/api/v1//avancement/jdoe/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw" -H "Authorization: Bearer $TOKEN"
{
"data": {
"type": "avancement",
"id": "jdoe/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw",
"attributes": {
"titre": "Grandeur Rectangle -2-",
"niveau": "base",
"état": "début",
"date_modification": null,
"date_réussite": null,
"extra": null
},
"links": {
"self": "https://progression.dti.crosemont.quebec/demo/api/v1/avancement/jdoe/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw",
"user": "https://progression.dti.crosemont.quebec/demo/api/v1/user/jdoe",
"question": "https://progression.dti.crosemont.quebec/demo/api/v1/question/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw",
"soumettre": "https://progression.dti.crosemont.quebec/demo/api/v1/avancement/jdoe/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/tentatives"
},
"relationships": {
"tentatives": {
"links": {
"self": "https://progression.dti.crosemont.quebec/demo/api/v1/avancement/jdoe/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/relationships/tentatives",
"related": "https://progression.dti.crosemont.quebec/demo/api/v1/avancement/jdoe/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/tentatives"
}
},
"sauvegardes": {
"links": {
"self": "https://progression.dti.crosemont.quebec/demo/api/v1/avancement/jdoe/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/relationships/sauvegardes",
"related": "https://progression.dti.crosemont.quebec/demo/api/v1/avancement/jdoe/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/sauvegardes"
}
}
}
}
}
Obtenir l’ébauche de solution en Python pour la question «Les fonctions avec paramètres/Rectangle»
curl "https://progression.dti.crosemont.quebec/demo/api/v1//ebauche/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/python" -H "Authorization: Bearer $TOKEN"
{
"data": {
"type": "ebauche",
"id": "aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/python",
"attributes": {
"langage": "python",
"code": "# Fonction qui calcule et produit en sortie le périmètre du rectangle dont les côtés sont reçus en paramètre. À faire\ndef périmètre( une_largeur, une_longueur ):\n # -TODO\n # -VISIBLE\n global compteur_appels\n compteur_appels += 1\n # +VISIBLE\n # +TODO\n\n\n# -TODO\n# Fonction qui calcule et produit en sortie l'aire du rectangle dont les côtés sont reçus en paramètre. À faire\n# +TODO\n\n\n\n# -TODO\n# Programme principal\n# -VISIBLE\ncompteur_appels = 0\n# +VISIBLE\n# Entrées\nlargeur = int( input() )\nlongueur = int( input() )\n\n# Appel des fonctions, les côtés du rectangle sont transmis en paramètre. À faire\npérimètre( largeur, longueur )\n# +TODO\n\n\n# -TODO\n# -VISIBLE\nif compteur_appels == 0:\n print( \"Incorrect: pas d'appel de fonction!\" )\n\n\n\n\n"
},
"links": {
"self": "https://progression.dti.crosemont.quebec/demo/api/v1/ebauche/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/python",
"question": "https://progression.dti.crosemont.quebec/demo/api/v1/question/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw"
}
}
}
Soumettre une tentative de solution à la question «Les fonctions avec paramètres/Rectangle» et récupérer les résultats
DATA=$(cat <<EOF { "data": { "type": "tentative", "attributes": { "langage":"python", "code":"# Fonction qui calcule et produit en sortie le périmètre du rectangle dont les côtés sont reçus en paramètre. À faire\ndef périmètre( une_largeur, une_longueur ):\n # -TODO\n # -VISIBLE\n\n\n # +VISIBLE\n # +TODO\n print(42)\n\n# -TODO\n# Fonction qui calcule et produit en sortie l'aire du rectangle dont les côtés sont reçus en paramètre. À faire\n# +TODO\n\n\n\n# -TODO\n# Programme principal\n# -VISIBLE\n\n# +VISIBLE\n# Entrées\nlargeur = int( input() )\nlongueur = int( input() )\n\n# Appel des fonctions, les côtés du rectangle sont transmis en paramètre. À faire\npérimètre( largeur, longueur )\n# +TODO\n\n\n# -TODO\n# -VISIBLE\n\n\n\n\n\n\n" } } } EOF )
curl --data "$DATA" https://progression.dti.crosemont.quebec/demo/api/v1//avancement/jdoe/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/tentatives?include=resultats -H "Content-Type: application/vnd.api+json" -H "Authorization: Bearer $TOKEN"
{
"data": {
"type": "tentative",
"id": "jdoe/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/1786683144",
"attributes": {
"date_soumission": 1786683144,
"réussi": false,
"temps_exécution": 0,
"feedback": "Définir et appeler chacune des deux fonctions qui recoit en paramètre les côtés du rectangle (largeur et longueur), calcule et produit en sortie le résultat!\n",
"sous_type": "tentativeProg",
"langage": "python",
"code": "# Fonction qui calcule et produit en sortie le périmètre du rectangle dont les côtés sont reçus en paramètre. À faire\ndef périmètre( une_largeur, une_longueur ):\n # -TODO\n # -VISIBLE\n\n\n # +VISIBLE\n # +TODO\n print(42)\n\n# -TODO\n# Fonction qui calcule et produit en sortie l'aire du rectangle dont les côtés sont reçus en paramètre. À faire\n# +TODO\n\n\n\n# -TODO\n# Programme principal\n# -VISIBLE\n\n# +VISIBLE\n# Entrées\nlargeur = int( input() )\nlongueur = int( input() )\n\n# Appel des fonctions, les côtés du rectangle sont transmis en paramètre. À faire\npérimètre( largeur, longueur )\n# +TODO\n\n\n# -TODO\n# -VISIBLE\n\n\n\n\n\n\n",
"tests_réussis": 0,
"publique": false
},
"links": {
"self": "https://progression.dti.crosemont.quebec/demo/api/v1/tentative/jdoe/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/1786683144",
"avancement": "https://progression.dti.crosemont.quebec/demo/api/v1/avancement/jdoe/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw",
"commentaires": "https://progression.dti.crosemont.quebec/demo/api/v1/tentative/jdoe/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/1786683144/commentaires"
},
"relationships": {
"resultats": {
"links": {
"self": "https://progression.dti.crosemont.quebec/demo/api/v1/tentative/jdoe/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/1786683144/relationships/resultats",
"related": "https://progression.dti.crosemont.quebec/demo/api/v1/tentative/jdoe/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/1786683144/resultats"
},
"data": [
{
"type": "resultat",
"id": "1672a7c6b11daa98ea3af7c3106ba882"
},
{
"type": "resultat",
"id": "6fdd4af402d70fbf525b4e80e538b590"
},
{
"type": "resultat",
"id": "81db78ec7ce4d06b4f4b0805d0209f07"
},
{
"type": "resultat",
"id": "bd5826a5bbf1e8bee961dfcc12016c78"
}
]
},
"commentaires": {
"links": {
"self": "https://progression.dti.crosemont.quebec/demo/api/v1/tentative/jdoe/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/1786683144/relationships/commentaires",
"related": "https://progression.dti.crosemont.quebec/demo/api/v1/tentative/jdoe/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/1786683144/commentaires"
}
}
}
},
"included": [
{
"type": "resultat",
"id": "1672a7c6b11daa98ea3af7c3106ba882",
"attributes": {
"sortie_observée": "42\n",
"sortie_erreur": "",
"résultat": false,
"feedback": null,
"temps_exécution": 34
},
"links": {
"self": "https://progression.dti.crosemont.quebec/demo/api/v1/resultat/1672a7c6b11daa98ea3af7c3106ba882",
"tentative": "https://progression.dti.crosemont.quebec/demo/api/v1/tentative/jdoe/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/1786683144"
}
},
{
"type": "resultat",
"id": "6fdd4af402d70fbf525b4e80e538b590",
"attributes": {
"sortie_observée": "42\n",
"sortie_erreur": "",
"résultat": false,
"feedback": null,
"temps_exécution": 29
},
"links": {
"self": "https://progression.dti.crosemont.quebec/demo/api/v1/resultat/6fdd4af402d70fbf525b4e80e538b590",
"tentative": "https://progression.dti.crosemont.quebec/demo/api/v1/tentative/jdoe/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/1786683144"
}
},
{
"type": "resultat",
"id": "81db78ec7ce4d06b4f4b0805d0209f07",
"attributes": {
"sortie_observée": "42\n",
"sortie_erreur": "",
"résultat": false,
"feedback": null,
"temps_exécution": 32
},
"links": {
"self": "https://progression.dti.crosemont.quebec/demo/api/v1/resultat/81db78ec7ce4d06b4f4b0805d0209f07",
"tentative": "https://progression.dti.crosemont.quebec/demo/api/v1/tentative/jdoe/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/1786683144"
}
},
{
"type": "resultat",
"id": "bd5826a5bbf1e8bee961dfcc12016c78",
"attributes": {
"sortie_observée": "42\n",
"sortie_erreur": "",
"résultat": false,
"feedback": null,
"temps_exécution": 35
},
"links": {
"self": "https://progression.dti.crosemont.quebec/demo/api/v1/resultat/bd5826a5bbf1e8bee961dfcc12016c78",
"tentative": "https://progression.dti.crosemont.quebec/demo/api/v1/tentative/jdoe/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/1786683144"
}
}
]
}
Obtenir une tentative de solution préalablement soumise pour la question «Les fonctions avec paramètres/Rectangle»
curl "https://progression.dti.crosemont.quebec/demo/api/v1//tentative/jdoe/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/$TIMESTAMP" -H "Authorization: Bearer $TOKEN"
{
"data": {
"type": "tentative",
"id": "jdoe/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/1786683145",
"attributes": {
"date_soumission": 1786683145,
"réussi": 0,
"temps_exécution": 0,
"feedback": null,
"sous_type": "tentativeProg",
"langage": "python",
"code": "# Fonction qui calcule et produit en sortie le périmètre du rectangle dont les côtés sont reçus en paramètre. À faire\ndef périmètre( une_largeur, une_longueur ):\n # -TODO\n # -VISIBLE\n\n\n # +VISIBLE\n # +TODO\n print(42)\n\n# -TODO\n# Fonction qui calcule et produit en sortie l'aire du rectangle dont les côtés sont reçus en paramètre. À faire\n# +TODO\n\n\n\n# -TODO\n# Programme principal\n# -VISIBLE\n\n# +VISIBLE\n# Entrées\nlargeur = int( input() )\nlongueur = int( input() )\n\n# Appel des fonctions, les côtés du rectangle sont transmis en paramètre. À faire\npérimètre( largeur, longueur )\n# +TODO\n\n\n# -TODO\n# -VISIBLE\n\n\n\n\n\n\n",
"tests_réussis": 0,
"publique": false
},
"links": {
"self": "https://progression.dti.crosemont.quebec/demo/api/v1/tentative/jdoe/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/1786683145",
"avancement": "https://progression.dti.crosemont.quebec/demo/api/v1/avancement/jdoe/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw",
"commentaires": "https://progression.dti.crosemont.quebec/demo/api/v1/tentative/jdoe/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/1786683145/commentaires"
},
"relationships": {
"commentaires": {
"links": {
"self": "https://progression.dti.crosemont.quebec/demo/api/v1/tentative/jdoe/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/1786683145/relationships/commentaires",
"related": "https://progression.dti.crosemont.quebec/demo/api/v1/tentative/jdoe/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/1786683145/commentaires"
}
},
"resultats": {
"links": {
"self": "https://progression.dti.crosemont.quebec/demo/api/v1/tentative/jdoe/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/1786683145/relationships/resultats",
"related": "https://progression.dti.crosemont.quebec/demo/api/v1/tentative/jdoe/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/1786683145/resultats"
}
}
}
}
}
Obtenir le test numéro 0 pour la question «Les fonctions avec paramètres/Rectangle»
curl "https://progression.dti.crosemont.quebec/demo/api/v1//test/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/0" -H "Authorization: Bearer $TOKEN"
{
"data": {
"type": "test",
"id": "aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/0",
"attributes": {
"nom": "Petit rectangle",
"caché": false,
"sortie_attendue": "4\n1\n",
"entrée": "1\n1\n",
"params": ""
},
"links": {
"self": "https://progression.dti.crosemont.quebec/demo/api/v1/test/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/0",
"question": "https://progression.dti.crosemont.quebec/demo/api/v1/question/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw"
}
}
}
Obtenir un token ressource qui donne accès à un avancement de jdoe pour la question «Les fonctions avec paramètres/Rectangle»
DATA=$(cat <<EOF { "data" : { "type": "token", "attributes" : { "expiration" : "+300", "data" : [], "ressources" : { "get_avancement" : { "url":"^avancement/jdoe/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw$", "method":"^GET$" } } } } } EOF )
curl --data "$DATA" https://progression.dti.crosemont.quebec/demo/api/v1//user/jdoe/tokens -H "Content-Type: application/json" -H "Authorization: Bearer $TOKEN"
{
"data": {
"type": "token",
"id": "SP8mlCbLaLOQ-2nMRCGvrSIGFx7iPuD0wNWRSE8fQf0",
"attributes": {
"username": "jdoe",
"création": 1786683146,
"expiration": 1786683446,
"data": [],
"jwt": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VybmFtZSI6Impkb2UiLCJjdXJyZW50IjoxNzg2NjgzMTQ2LCJleHBpcmVkIjoxNzg2NjgzNDQ2LCJkYXRhIjpbXSwidmVyc2lvbiI6IjQuMTEuMyIsInJlc3NvdXJjZXMiOnsiZ2V0X2F2YW5jZW1lbnQiOnsidXJsIjoiXmF2YW5jZW1lbnQvamRvZS9hSFIwY0hNNkx5OXdjbTluY21WemMybHZiaTV3WVdkbGN5NWtkR2t1WTNKdmMyVnRiMjUwTG5GMVpXSmxZeTlqYjI1MFpXNTFMM0J5YjJkZk1TODVZbVJtTldZeFlTMDBPRGxoTFRRME1XWXRPV1UyWlMweVl6ZzNZbUpoTlRoaVpqZ3ZhVzVtYnk1NWJXdyQiLCJtZXRob2QiOiJeR0VUJCJ9fX0.SP8mlCbLaLOQ-2nMRCGvrSIGFx7iPuD0wNWRSE8fQf0",
"version": "4.11.3",
"ressources": {
"get_avancement": {
"url": "^avancement/jdoe/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw$",
"method": "^GET$"
}
}
},
"links": {
"self": "https://progression.dti.crosemont.quebec/demo/api/v1/token/SP8mlCbLaLOQ-2nMRCGvrSIGFx7iPuD0wNWRSE8fQf0",
"user": "https://progression.dti.crosemont.quebec/demo/api/v1/user/jdoe"
}
}
}
Créer ou mettre à jour la sauvegarde de jdoe pour la question «Les fonctions avec paramètres/Rectangle» et un code python
DATA=$(cat <<EOF { "data": { "type": "sauvegarde", "attributes": { "langage":"python", "code": "#+TODO\nSystem.out.println('Allo le monde');\n#-TODO" } } } EOF )
curl --data "$DATA" https://progression.dti.crosemont.quebec/demo/api/v1//avancement/jdoe/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/sauvegardes -H "Content-Type: application/vnd.api+json" -H "Authorization: Bearer $TOKEN"
{
"data": {
"type": "sauvegarde",
"id": "jdoe/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/python",
"attributes": {
"date_sauvegarde": 1786683146,
"code": "#+TODO\nSystem.out.println('Allo le monde');\n#-TODO"
},
"links": {
"self": "https://progression.dti.crosemont.quebec/demo/api/v1/sauvegarde/jdoe/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/python",
"avancement": "https://progression.dti.crosemont.quebec/demo/api/v1/avancement/jdoe/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw"
}
}
}
Obtenir la dernière sauvegarde de jdoe pour la question «Les fonctions avec paramètres/Rectangle» effectuée avec le langage python:
curl "https://progression.dti.crosemont.quebec/demo/api/v1//sauvegarde/jdoe/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/python" -H "Authorization: Bearer $TOKEN"
{
"data": {
"type": "sauvegarde",
"id": "jdoe/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/python",
"attributes": {
"date_sauvegarde": 1786683146,
"code": "#+TODO\nSystem.out.println('Allo le monde');\n#-TODO"
},
"links": {
"self": "https://progression.dti.crosemont.quebec/demo/api/v1/sauvegarde/jdoe/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw/python",
"avancement": "https://progression.dti.crosemont.quebec/demo/api/v1/avancement/jdoe/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw"
}
}
}
Créer une clé d’authentification pour jdoe
DATA=$(cat <<EOF { "data": { "type": "cle", "attributes": { "nom":"cleAuth$(head -c 9 /dev/urandom|base64|tr '/+' '_-')", "portée": "auth" } } } EOF )
curl --data "$DATA" "https://progression.dti.crosemont.quebec/demo/api/v1//user/jdoe/cles" -H "Content-Type: application/vnd.api+json" -H "Authorization: Basic amRvZTo="
{
"data": {
"type": "cle",
"id": "jdoe/cleAuthjIucTSWo5L-R",
"attributes": {
"secret": "faf53957d4b632fb785aded77727138dbe550890",
"création": 1786683147,
"expiration": 0,
"portée": "auth"
},
"links": {
"self": "https://progression.dti.crosemont.quebec/demo/api/v1/cle/jdoe/cleAuthjIucTSWo5L-R",
"user": "https://progression.dti.crosemont.quebec/demo/api/v1/user/jdoe"
}
}
}
Authentification par clé d’authentification pour jdoe
AUTH=$(echo -n "jdoe:$NOM_CLE:$SECRET" | base64 -w0)
DATA=$(cat <<EOF { "data": { "type": "token", "attributes": { "expiration" : "+300", "data" : [], "ressources" : { "get_avancement" : { "url":"^avancement/jdoe/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw$", "method":"^GET$" } } } } } EOF )
curl --data "$DATA" https://progression.dti.crosemont.quebec/demo/api/v1//user/jdoe/tokens -H "Content-Type: application/vnd.api+json" -H "Authorization: key $AUTH"
{
"data": {
"type": "token",
"id": "Lc1YIPoSzMGgk5KWntDhs262Nbo_yfViAwprolh85Dw",
"attributes": {
"username": "jdoe",
"création": 1786683147,
"expiration": 1786683447,
"data": [],
"jwt": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VybmFtZSI6Impkb2UiLCJjdXJyZW50IjoxNzg2NjgzMTQ3LCJleHBpcmVkIjoxNzg2NjgzNDQ3LCJkYXRhIjpbXSwidmVyc2lvbiI6IjQuMTEuMyIsInJlc3NvdXJjZXMiOnsiZ2V0X2F2YW5jZW1lbnQiOnsidXJsIjoiXmF2YW5jZW1lbnQvamRvZS9hSFIwY0hNNkx5OXdjbTluY21WemMybHZiaTV3WVdkbGN5NWtkR2t1WTNKdmMyVnRiMjUwTG5GMVpXSmxZeTlqYjI1MFpXNTFMM0J5YjJkZk1TODVZbVJtTldZeFlTMDBPRGxoTFRRME1XWXRPV1UyWlMweVl6ZzNZbUpoTlRoaVpqZ3ZhVzVtYnk1NWJXdyQiLCJtZXRob2QiOiJeR0VUJCJ9fX0.Lc1YIPoSzMGgk5KWntDhs262Nbo_yfViAwprolh85Dw",
"version": "4.11.3",
"ressources": {
"get_avancement": {
"url": "^avancement/jdoe/aHR0cHM6Ly9wcm9ncmVzc2lvbi5wYWdlcy5kdGkuY3Jvc2Vtb250LnF1ZWJlYy9jb250ZW51L3Byb2dfMS85YmRmNWYxYS00ODlhLTQ0MWYtOWU2ZS0yYzg3YmJhNThiZjgvaW5mby55bWw$",
"method": "^GET$"
}
}
},
"links": {
"self": "https://progression.dti.crosemont.quebec/demo/api/v1/token/Lc1YIPoSzMGgk5KWntDhs262Nbo_yfViAwprolh85Dw",
"user": "https://progression.dti.crosemont.quebec/demo/api/v1/user/jdoe"
}
}
}