| author | ymh <ymh.work@gmail.com> |
| Fri, 15 Sep 2017 14:11:36 +0200 | |
| changeset 658 | cac26275af31 |
| parent 618 | 3051b847c124 |
| permissions | -rw-r--r-- |
| 590 | 1 |
# Renkan API Documentation |
2 |
||
3 |
Ce document présente le fonctionnement et les différentes méthodes de l'API Renkan, basée sur DjangoRestFramework |
|
4 |
||
5 |
### Objets manipulés et représentation en JSON |
|
6 |
||
7 |
##### Renkan |
|
8 |
||
|
618
3051b847c124
validation_timestamp and create_new_revision are not part of the data. move them to query parameters
ymh <ymh.work@gmail.com>
parents:
590
diff
changeset
|
9 |
L'objet Renkan est le principal point d'entrée de l'API. |
| 590 | 10 |
Chaque Renkan est associé à au plus un workspace et au moins une révision |
11 |
||
|
618
3051b847c124
validation_timestamp and create_new_revision are not part of the data. move them to query parameters
ymh <ymh.work@gmail.com>
parents:
590
diff
changeset
|
12 |
* Représentation JSON |
| 590 | 13 |
|
14 |
```sh |
|
15 |
{ |
|
16 |
"id" : id du renkan, |
|
17 |
"title" : titre du renkan, |
|
18 |
"content" : contenu (JSON) du renkan, |
|
19 |
"current_revision_id" : id de la révision courante du renkan, |
|
20 |
"source_revision_id" : id de la révision ayant servi à copier le renkan, chaîne vide sinon, |
|
21 |
"workspace_id" : si le renkan est assigné à un workspace, id du workspace du renkan, |
|
22 |
"revision_count": le nombre de révisions du renkan au moment du la requête, |
|
23 |
"created_by" : username du créateur du renkan, |
|
24 |
"last_updated_by" : username du dernier utilisateur à avoir modifié le renkan, |
|
25 |
"creation_date" : date de création du renkan, |
|
26 |
"modification_date" : date de dernière modification du renkan, |
|
27 |
} |
|
28 |
``` |
|
29 |
||
30 |
##### Révisions |
|
31 |
||
|
618
3051b847c124
validation_timestamp and create_new_revision are not part of the data. move them to query parameters
ymh <ymh.work@gmail.com>
parents:
590
diff
changeset
|
32 |
Une révision représente l'état d'un renkan à un instant donné. |
|
3051b847c124
validation_timestamp and create_new_revision are not part of the data. move them to query parameters
ymh <ymh.work@gmail.com>
parents:
590
diff
changeset
|
33 |
Chaque révision est associé à un unique Renkan. Lorsqu'un renkan est modifié, on peut soit altérer la révision courante, soit créer une nouvelle révision. La dernière révision d'un renkan donné créée est la "révision courante" de ce renkan. |
| 590 | 34 |
|
|
618
3051b847c124
validation_timestamp and create_new_revision are not part of the data. move them to query parameters
ymh <ymh.work@gmail.com>
parents:
590
diff
changeset
|
35 |
C'est au niveau de l'objet Révision que sont stockées les informations de titre et de contenu d'un Renkan. |
| 590 | 36 |
|
|
618
3051b847c124
validation_timestamp and create_new_revision are not part of the data. move them to query parameters
ymh <ymh.work@gmail.com>
parents:
590
diff
changeset
|
37 |
* Représentation JSON |
| 590 | 38 |
|
39 |
```sh |
|
40 |
{ |
|
41 |
"id" : id de la revision |
|
42 |
"title" : titre de la revision |
|
43 |
"content" : contenu (JSON) de la revision |
|
|
618
3051b847c124
validation_timestamp and create_new_revision are not part of the data. move them to query parameters
ymh <ymh.work@gmail.com>
parents:
590
diff
changeset
|
44 |
"parent_renkan_id" : id du renkan associé à la révision |
|
3051b847c124
validation_timestamp and create_new_revision are not part of the data. move them to query parameters
ymh <ymh.work@gmail.com>
parents:
590
diff
changeset
|
45 |
"workspace_id" : si le renkan associé à la révision est assigné à un workspace, |
| 590 | 46 |
id du workspace du renkan, |
47 |
"renkan_created_by" : username du créateur du renkan |
|
48 |
"renkan_last_updated_by" : username du dernier utilisateur à avoir modifié le renkan |
|
49 |
"revision_created_by" : username du créateur de la révision |
|
|
618
3051b847c124
validation_timestamp and create_new_revision are not part of the data. move them to query parameters
ymh <ymh.work@gmail.com>
parents:
590
diff
changeset
|
50 |
"revision_last_updated_by" : username du dernier utilisateur à avoir modifié la révision |
| 590 | 51 |
"revision_modification_date" : date de dernière modification de la révision |
52 |
} |
|
53 |
``` |
|
54 |
||
55 |
##### Workspaces |
|
|
618
3051b847c124
validation_timestamp and create_new_revision are not part of the data. move them to query parameters
ymh <ymh.work@gmail.com>
parents:
590
diff
changeset
|
56 |
Un workspace (ou espace) renkan est une structure (optionnelle) regroupant un ou plusieurs renkans. |
| 590 | 57 |
|
|
618
3051b847c124
validation_timestamp and create_new_revision are not part of the data. move them to query parameters
ymh <ymh.work@gmail.com>
parents:
590
diff
changeset
|
58 |
* Représentation JSON |
| 590 | 59 |
|
60 |
```sh |
|
61 |
{ |
|
62 |
"id" : id du workspace |
|
63 |
"title" : titre du workspace |
|
64 |
"renkan_count": nombre de renkans associés au workspace |
|
65 |
"revision_created_by" : username du créateur du workspace |
|
66 |
"creation_date": date de création du workspace |
|
67 |
} |
|
68 |
``` |
|
69 |
||
70 |
### Liste exhaustive des endpoints de l'API |
|
71 |
||
72 |
#### Endpoints Renkan |
|
|
618
3051b847c124
validation_timestamp and create_new_revision are not part of the data. move them to query parameters
ymh <ymh.work@gmail.com>
parents:
590
diff
changeset
|
73 |
|
|
3051b847c124
validation_timestamp and create_new_revision are not part of the data. move them to query parameters
ymh <ymh.work@gmail.com>
parents:
590
diff
changeset
|
74 |
##### 1. Créer un Renkan |
| 590 | 75 |
```POST /renkan-api/renkans/``` |
76 |
||
77 |
Données à passer en JSON (facultatif): |
|
78 |
``` |
|
79 |
{ |
|
80 |
"title": titre du renkan à créer (facultatif) |
|
81 |
"content": JSON du renkan à créer (facultatif) |
|
82 |
} |
|
83 |
``` |
|
84 |
||
85 |
**Note:** Si aucun titre n'est fournie le renkan sera intitulé "Untitled Renkan". Si aucun contenu n'est fourni un JSON minimal sera généré |
|
86 |
||
87 |
Si succès: Renvoie ```201 CREATED``` et le json associé au renkan créé |
|
88 |
||
|
618
3051b847c124
validation_timestamp and create_new_revision are not part of the data. move them to query parameters
ymh <ymh.work@gmail.com>
parents:
590
diff
changeset
|
89 |
##### 2. Dupliquer un Renkan |
|
3051b847c124
validation_timestamp and create_new_revision are not part of the data. move them to query parameters
ymh <ymh.work@gmail.com>
parents:
590
diff
changeset
|
90 |
```POST /renkan-api/renkans/?source_renkan_id=<:renkan_id>``` |
| 590 | 91 |
|
92 |
Données à passer en JSON: |
|
93 |
``` |
|
94 |
{ |
|
95 |
"title": titre de la copie (facultatif) |
|
96 |
} |
|
|
618
3051b847c124
validation_timestamp and create_new_revision are not part of the data. move them to query parameters
ymh <ymh.work@gmail.com>
parents:
590
diff
changeset
|
97 |
``` |
| 590 | 98 |
|
99 |
**Note:** Dans l'implémentation actuelle, si la donnée "title" n'est pas fournie, le titre du renkan copié sera identique au titre du renkan source. |
|
100 |
||
|
618
3051b847c124
validation_timestamp and create_new_revision are not part of the data. move them to query parameters
ymh <ymh.work@gmail.com>
parents:
590
diff
changeset
|
101 |
Si succès: renvoie ```201 CREATED``` et le json décrivant le renkan créé. |
| 590 | 102 |
Si échec: renvoie un ```404 NOT FOUND``` si ```<:renkan_id>``` ne correspond à aucun renkan existant |
103 |
||
|
618
3051b847c124
validation_timestamp and create_new_revision are not part of the data. move them to query parameters
ymh <ymh.work@gmail.com>
parents:
590
diff
changeset
|
104 |
##### 3. Modifier un Renkan |
| 590 | 105 |
```PUT /renkan-api/renkans/<:renkan_id>``` |
106 |
||
107 |
Données à passer en JSON: |
|
108 |
``` |
|
109 |
{ |
|
110 |
"title": nouveau titre du renkan |
|
111 |
} |
|
112 |
``` |
|
113 |
||
|
618
3051b847c124
validation_timestamp and create_new_revision are not part of the data. move them to query parameters
ymh <ymh.work@gmail.com>
parents:
590
diff
changeset
|
114 |
###### Paramêtres de requête |
|
3051b847c124
validation_timestamp and create_new_revision are not part of the data. move them to query parameters
ymh <ymh.work@gmail.com>
parents:
590
diff
changeset
|
115 |
- **```validation_timestamp```** : date (urlencodée) au format ISO8601 correspondant à valeur du champ ```updated``` du contenu du renkan à modifier. Est utilisé pour vérifier que le renkan cible n'ai pas été modifié entre 2 requêtes. |
|
3051b847c124
validation_timestamp and create_new_revision are not part of the data. move them to query parameters
ymh <ymh.work@gmail.com>
parents:
590
diff
changeset
|
116 |
- **```create_new_revision```** : Force la création d'une nouvelle révision pour le Renkan. Si ```false```, la révision counrant est mise à jour. ```false``` par défaut. |
|
3051b847c124
validation_timestamp and create_new_revision are not part of the data. move them to query parameters
ymh <ymh.work@gmail.com>
parents:
590
diff
changeset
|
117 |
- **```content_only```** : Retourne seulement le contenu du renkan dans le reeponse, et pas les métadata. |
|
3051b847c124
validation_timestamp and create_new_revision are not part of the data. move them to query parameters
ymh <ymh.work@gmail.com>
parents:
590
diff
changeset
|
118 |
|
|
3051b847c124
validation_timestamp and create_new_revision are not part of the data. move them to query parameters
ymh <ymh.work@gmail.com>
parents:
590
diff
changeset
|
119 |
Si succès: renvoie ```200 OK``` et le json associé au renkan modifié |
| 590 | 120 |
Si échec: renvoie un ```404 NOT FOUND``` si ```<:renkan_id>``` ne correspond à aucun renkan existant. |
121 |
||
|
618
3051b847c124
validation_timestamp and create_new_revision are not part of the data. move them to query parameters
ymh <ymh.work@gmail.com>
parents:
590
diff
changeset
|
122 |
##### 4. Obtenir la liste des Renkan |
| 590 | 123 |
```GET /renkan-api/renkans/``` |
124 |
||
125 |
Renvoie la liste des renkans auxquels l'utilisateur authentifié a accès en lecture. |
|
126 |
||
127 |
Si succès: Renvoie ```200 OK```et une liste où chaque élément correspond à un json de renkan. |
|
128 |
||
|
618
3051b847c124
validation_timestamp and create_new_revision are not part of the data. move them to query parameters
ymh <ymh.work@gmail.com>
parents:
590
diff
changeset
|
129 |
##### 5. Obtenir les informations sur un Renkan |
|
3051b847c124
validation_timestamp and create_new_revision are not part of the data. move them to query parameters
ymh <ymh.work@gmail.com>
parents:
590
diff
changeset
|
130 |
```GET /renkan-api/renkans/<:renkan_id>``` |
| 590 | 131 |
|
|
618
3051b847c124
validation_timestamp and create_new_revision are not part of the data. move them to query parameters
ymh <ymh.work@gmail.com>
parents:
590
diff
changeset
|
132 |
Si succès: renvoie ```200 OK``` et le json associé au renkan requêté |
| 590 | 133 |
Si échec: renvoie ```404 NOT FOUND``` si ```<:renkan_id>``` ne correspond à aucun renkan existant. |
134 |
||
|
618
3051b847c124
validation_timestamp and create_new_revision are not part of the data. move them to query parameters
ymh <ymh.work@gmail.com>
parents:
590
diff
changeset
|
135 |
##### 6. Supprimer un renkan |
| 590 | 136 |
```DELETE /renkan-api/renkans/<:renkan_id>``` |
137 |
||
|
618
3051b847c124
validation_timestamp and create_new_revision are not part of the data. move them to query parameters
ymh <ymh.work@gmail.com>
parents:
590
diff
changeset
|
138 |
Si succès: renvoie ```204 NO CONTENT``` |
| 590 | 139 |
Si échec: renvoie un ```404 NOT FOUND``` si ```<:renkan_id>``` ne correspond à aucun renkan existant. |
140 |
||
141 |
#### Endpoints Révision |
|
|
618
3051b847c124
validation_timestamp and create_new_revision are not part of the data. move them to query parameters
ymh <ymh.work@gmail.com>
parents:
590
diff
changeset
|
142 |
|
|
3051b847c124
validation_timestamp and create_new_revision are not part of the data. move them to query parameters
ymh <ymh.work@gmail.com>
parents:
590
diff
changeset
|
143 |
##### 1. Obtenir la liste des révisions pour un Renkan donné |
| 590 | 144 |
```GET /renkan-api/renkans/<:renkan_id>/revisions/``` |
145 |
||
|
618
3051b847c124
validation_timestamp and create_new_revision are not part of the data. move them to query parameters
ymh <ymh.work@gmail.com>
parents:
590
diff
changeset
|
146 |
Si succès: Renvoie ```200 OK``` et une liste où chaque élément est un json correspondant à une révision. |
| 590 | 147 |
Si échec: Renvoie un ```404 NOT FOUND``` si le ```<:renkan_id>``` ne correspond à aucun renkan existant |
148 |
||
|
618
3051b847c124
validation_timestamp and create_new_revision are not part of the data. move them to query parameters
ymh <ymh.work@gmail.com>
parents:
590
diff
changeset
|
149 |
##### 2. Obtenir les informations sur une révision |
| 590 | 150 |
```GET /renkan-api/renkans/<:renkan_id>/revisions/<:revision_id>``` |
151 |
||
|
618
3051b847c124
validation_timestamp and create_new_revision are not part of the data. move them to query parameters
ymh <ymh.work@gmail.com>
parents:
590
diff
changeset
|
152 |
Si succès: renvoie ```200 OK``` et le json associé à la révision requêtée |
| 590 | 153 |
Si échec: renvoie un ```404 NOT FOUND``` si ```<:renkan_id>``` ne correspond à aucun renkan existant ou que ```<:revision_id>``` ne correspond à aucune révision existante. |
154 |
||
|
618
3051b847c124
validation_timestamp and create_new_revision are not part of the data. move them to query parameters
ymh <ymh.work@gmail.com>
parents:
590
diff
changeset
|
155 |
##### 3. Supprimer une révision |
| 590 | 156 |
```DELETE /renkan-api/renkans/<:renkan_id>/revisions/<:revision_id>``` |
157 |
||
158 |
**Note:** il est impossible de supprimer la "révision courante" d'un renkan. |
|
159 |
||
|
618
3051b847c124
validation_timestamp and create_new_revision are not part of the data. move them to query parameters
ymh <ymh.work@gmail.com>
parents:
590
diff
changeset
|
160 |
Si succès: renvoie ```204 NO CONTENT``` |
| 590 | 161 |
Si échec: renvoie un ```404 NOT FOUND``` si ```<:renkan_id>``` ne correspond à aucun renkan existant ou si ```<:revision_id>``` ne correspond à aucune révision existante |
162 |
||
163 |
#### Endpoints Workspace |
|
|
618
3051b847c124
validation_timestamp and create_new_revision are not part of the data. move them to query parameters
ymh <ymh.work@gmail.com>
parents:
590
diff
changeset
|
164 |
##### 1. Créer un Workspace |
| 590 | 165 |
```POST /renkan-api/workspaces/``` |
166 |
||
167 |
Données à fournir en JSON (facultatif): |
|
|
618
3051b847c124
validation_timestamp and create_new_revision are not part of the data. move them to query parameters
ymh <ymh.work@gmail.com>
parents:
590
diff
changeset
|
168 |
``` |
| 590 | 169 |
{ |
170 |
"title": titre du workspace à créer |
|
171 |
} |
|
172 |
``` |
|
173 |
||
174 |
Si succès: Renvoie ```201 CREATED``` et le json associé au workspace créé |
|
175 |
||
|
618
3051b847c124
validation_timestamp and create_new_revision are not part of the data. move them to query parameters
ymh <ymh.work@gmail.com>
parents:
590
diff
changeset
|
176 |
##### 2. Créer un Renkan dans un Workspace donné |
| 590 | 177 |
```POST /renkan-api/workspaces/<:workspace_id>/renkans/``` |
178 |
||
179 |
Données (facultatif): |
|
180 |
``` |
|
181 |
{ |
|
182 |
"title": titre du renkan à créer (facultatif) |
|
183 |
"content": JSON du renkan à créer (facultatif) |
|
184 |
} |
|
185 |
``` |
|
186 |
||
187 |
**Note:** Si aucun titre n'est fournie le renkan sera intitulé "Untitled Renkan". Si aucun contenu n'est fourni un JSON minimal sera généré |
|
188 |
||
|
618
3051b847c124
validation_timestamp and create_new_revision are not part of the data. move them to query parameters
ymh <ymh.work@gmail.com>
parents:
590
diff
changeset
|
189 |
Si succès: Renvoie ```201 CREATED``` et le json associé au renkan créé |
| 590 | 190 |
Si échec: Renvoie un ```404 NOT FOUND``` si le ```<:workspace_id>``` ne correspond à aucun workspace exis-tant |
191 |
||
|
618
3051b847c124
validation_timestamp and create_new_revision are not part of the data. move them to query parameters
ymh <ymh.work@gmail.com>
parents:
590
diff
changeset
|
192 |
##### 3. Obtenir la liste des Workspaces |
| 590 | 193 |
```GET /renkan-api/workspaces/ ``` |
194 |
||
195 |
Si succès: renvoie ```200 OK``` et une liste où chaque élément est un json correspondant à un workspace. |
|
196 |
||
|
618
3051b847c124
validation_timestamp and create_new_revision are not part of the data. move them to query parameters
ymh <ymh.work@gmail.com>
parents:
590
diff
changeset
|
197 |
##### 4. Obtenir la liste des Renkan associé à un Workspace donné |
| 590 | 198 |
```GET /renkan-api/workspace/<:workspace_id>/renkans/``` |
199 |
||
200 |
Renvoie la liste des renkans (associés au workspace) auxquels l'utilisateur authentifié a accès en lecture. |
|
201 |
||
|
618
3051b847c124
validation_timestamp and create_new_revision are not part of the data. move them to query parameters
ymh <ymh.work@gmail.com>
parents:
590
diff
changeset
|
202 |
Si succès: Renvoie ```200 OK``` et une liste où chaque élément correspond à un json de renkan. |
| 590 | 203 |
Si échec: Renvoie un ```404 NOT FOUND``` si le ```<:workspace_id>``` ne correspond à aucun workspace exis-tant |
204 |
||
|
618
3051b847c124
validation_timestamp and create_new_revision are not part of the data. move them to query parameters
ymh <ymh.work@gmail.com>
parents:
590
diff
changeset
|
205 |
##### 5. Obtenir les informations sur un Workspace |
| 590 | 206 |
```GET /renkan-api/workspaces/``` |
207 |
||
|
618
3051b847c124
validation_timestamp and create_new_revision are not part of the data. move them to query parameters
ymh <ymh.work@gmail.com>
parents:
590
diff
changeset
|
208 |
Si succès:renvoie ```200 OK``` et une liste où chaque élément est un json correspondant à un workspace. |
| 590 | 209 |
Si échec: renvoie un ```404 NOT FOUND``` si le ```<:workspace_id>``` ne correspond à aucun workspace existant |
210 |
||
|
618
3051b847c124
validation_timestamp and create_new_revision are not part of the data. move them to query parameters
ymh <ymh.work@gmail.com>
parents:
590
diff
changeset
|
211 |
##### 6. Supprimer un Workspace |
| 590 | 212 |
```DELETE /renkan-api/workspaces/<:workspace_id>``` |
213 |
||
214 |
Note: il est impossible de supprimer un workspace s'il reste au moins un renkan assigné à celui-ci. |
|
215 |
||
|
618
3051b847c124
validation_timestamp and create_new_revision are not part of the data. move them to query parameters
ymh <ymh.work@gmail.com>
parents:
590
diff
changeset
|
216 |
Si succès: renvoie ```204 NO CONTENT``` |
|
3051b847c124
validation_timestamp and create_new_revision are not part of the data. move them to query parameters
ymh <ymh.work@gmail.com>
parents:
590
diff
changeset
|
217 |
Si échec: renvoie un ```404 NOT FOUND``` si le ```<:workspace_id>``` ne correspond à aucun workspace existant |