Rev 11380 | Rev 13362 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
13229 | obado | 1 | # Protocol for WIMS direct connection with other web servers |
23 | reyssat | 2 | |
13229 | obado | 3 | WIMS direct communication with another web server is two-directional. |
4 | It can receive http/https requests from the other server, and/or send http/https requests to the other. |
||
5 | The connectable server must be declared in a file |
||
6 | within the directory `WIMS_HOME/log/classes/.connections/`. |
||
23 | reyssat | 7 | |
13229 | obado | 8 | Requests sent to WIMS should obey the format described below. Results of such requests can be formatted according to the need of the connecting software. |
23 | reyssat | 9 | |
10 | Outgoing requests sent by WIMS can be formatted according to the |
||
13229 | obado | 11 | specification of the receiving software, |
12 | while the result of the request should be formatted according to the need of WIMS, as described below. |
||
23 | reyssat | 13 | |
13229 | obado | 14 | _________________________________________________________________ |
15 | ## Request format |
||
391 | obado | 16 | |
13229 | obado | 17 | A request from a connecting server is an http/https request sent to the main cgi program of the WIMS server, followed by parameter definitions as in a usual http protocol. |
23 | reyssat | 18 | |
13229 | obado | 19 | All requests must contain the following common parameters: |
23 | reyssat | 20 | |
13229 | obado | 21 | --- |
22 | | Name | Value | |
||
23 | |--------|----------------------------| |
||
24 | | module | adm/raw | |
||
25 | | ident | sender identifier (a word, according to the definition in `WIMS_HOME/log/classes/.connections/`) | |
||
26 | | passwd | sender password (as defined in `WIMS_HOME/log/classes/.connections/`) | |
||
27 | | code | a random word. This word will be sent back to the sender, in order to allow it to check whether the result is from the good request. | |
||
28 | | job | type of request, see below. | |
||
29 | --- |
||
23 | reyssat | 30 | |
31 | |||
13229 | obado | 32 | And the following parameters may be added according to the type |
23 | reyssat | 33 | of the request. |
34 | |||
13229 | obado | 35 | | Name | Value | |
36 | |----------|----------------------------| |
||
37 | | qclass | identifier of the class on the receiving server. It should be an integer. | |
||
38 | | qprogram | | |
||
39 | | quser | user identifier in the receiving server (when the request concerns a particular user). | |
||
40 | | qsheet | sheet identifier in the receiving server (when the request concerns a particular sheet). | |
||
41 | | rclass | identifier of the class on the sending server. | |
||
42 | | format | Format of the data. | |
||
43 | | option | Different meaning according to request. | |
||
44 | | data1 | Different meaning according to request. | |
||
45 | --- |
||
23 | reyssat | 46 | |
13229 | obado | 47 | For example, the following request checks whether the class `12345` exists on |
48 | the WIMS server `wims.unice.fr`, sent by a connecting server called `friend1` (by |
||
49 | wims.unice.fr), with password `abcde`. |
||
23 | reyssat | 50 | |
13229 | obado | 51 | `https://wims.unice.fr/wims/wims.cgi?module=adm/raw&ident=friend1&passwd=abcde&code=afdqreaf1r783&job=checkclass&qclass=12345&rclass=myclass` |
23 | reyssat | 52 | |
13229 | obado | 53 | Note that for this check to return OK, the class `12345` on wims.unice.fr must |
54 | have declared `friend1/myclass` as connectable. |
||
23 | reyssat | 55 | |
9815 | obado | 56 | _______________________________________________________________________________ |
23 | reyssat | 57 | |
13229 | obado | 58 | ## Query output |
23 | reyssat | 59 | |
60 | The query output (that is, the result of the http query) is always of |
||
61 | text/plain type (even if sometimes the output is a binary file). |
||
62 | |||
13229 | obado | 63 | **WIMS OUTPUT TYPE** : (old fashioned way, non-recommended) |
9691 | obado | 64 | The first line of the output content is a status line, which is either a |
65 | word OK followed by the random code contained in the request, or the |
||
66 | word ERROR. If the first line is not as such, then there is a |
||
67 | serious error in the request or a bug in the server software. |
||
68 | In case the status is OK, the remaining of the output content is the |
||
69 | content of the data. Otherwise the second line contains the nature of |
||
70 | the error. |
||
71 | |||
13229 | obado | 72 | **JSON OUTPUT TYPE** : (recommended) |
73 | output values are returned json formatted. (see [http://json.org]() for more |
||
9815 | obado | 74 | details) |
75 | _______________________________________________________________________________ |
||
23 | reyssat | 76 | |
13229 | obado | 77 | ## Types of the requests. |
23 | reyssat | 78 | |
9815 | obado | 79 | A request to WIMS can have the following types (defined by the parameter 'job') |
23 | reyssat | 80 | |
13229 | obado | 81 | * **job=help** Show this text. |
23 | reyssat | 82 | |
13229 | obado | 83 | * **job=checkident** Check whether the connection is accepted. |
23 | reyssat | 84 | |
13229 | obado | 85 | * **job=checkclass** Check whether the class accepts connection. |
23 | reyssat | 86 | |
13229 | obado | 87 | * **job=checkuser** Check whether the user exists. |
23 | reyssat | 88 | |
13229 | obado | 89 | * **job=checksheet** Check whether the sheet exists. |
391 | obado | 90 | |
13229 | obado | 91 | * **job=addclass** Add a class on the receiving server. |
9815 | obado | 92 | |
13229 | obado | 93 | For this request, `data1` should be a multi-line text defining the |
9815 | obado | 94 | properties of the new class. Each line contains a definition in the format |
13229 | obado | 95 | `name=value`. (This text must be reformatted for http query string) |
9691 | obado | 96 | The following names may be present in the definitions: |
23 | reyssat | 97 | |
13229 | obado | 98 | * **mandatory:** |
99 | * description = name of the class |
||
100 | * institution = name of the institution |
||
101 | * supervisor = full name of the supervisor |
||
102 | * email = contact email address |
||
103 | * password = password for user registration |
||
104 | * lang = class language (en, fr, es, it, etc) |
||
105 | * **optional:** |
||
106 | * expiration = class expiration date (yyyymmdd) |
||
107 | (optional, defaults to one year later) |
||
108 | * limit = limit of number of participants |
||
109 | (optional, defaults to 30) |
||
110 | * level = level of the class (optional, defaults to H4) |
||
111 | Valid levels: E1, E2, ..., E6, H1, ..., H6, |
||
112 | U1, ..., U5, G, R |
||
113 | * secure = secure hosts |
||
114 | * bgcolor = page background color |
||
115 | * refcolor = menu background color |
||
116 | * css = css file (must be existing css on the WIMS server) |
||
117 | |||
118 | `data2` should be a multi-line text defining the supervisor account, in the |
||
9815 | obado | 119 | same format as for data1. |
9691 | obado | 120 | The following names may be present in the definitions: |
23 | reyssat | 121 | |
13229 | obado | 122 | * **mandatory:** |
123 | * lastname = last name of the supervisor user |
||
124 | * firstname = first name of the supervisor user |
||
125 | * password = supervisor user's password, non-crypted. |
||
126 | * **optional** |
||
127 | * email = supervisor email address |
||
128 | * comments = any comments |
||
129 | * regnum = registration number |
||
130 | * photourl = url of a user picture |
||
131 | * participate = list classes (if in a class group) where user participates |
||
132 | * courses = |
||
133 | * classes = |
||
134 | * supervise = |
||
135 | * supervisable = |
||
136 | * external_auth = |
||
137 | * agreecgu = Boolean indicating if user accepted CGU |
||
138 | * regprop[1..5] = custom properties |
||
23 | reyssat | 139 | |
9816 | obado | 140 | |
13229 | obado | 141 | * **job=adduser** Add a user to the specified class. |
23 | reyssat | 142 | |
13229 | obado | 143 | `data1` should be a multi-line text defining the user account. |
9815 | obado | 144 | The following names may be present in the definitions: |
13229 | obado | 145 | |
146 | * **mandatory:** |
||
147 | * lastname = user's lastname |
||
148 | * firstname = user's firstname |
||
149 | * password = user's password, non-crypted. |
||
150 | * **optional** |
||
151 | * email = email address |
||
152 | * comments = any comments |
||
153 | * regnum = registration number |
||
154 | * photourl = url of user’s photo |
||
155 | * participate = list classes where user participates |
||
156 | (only for group and portal) |
||
157 | * courses = special for portal |
||
158 | * classes = special for portal |
||
159 | * supervise = List classes where teacher are administator |
||
160 | (only for group and portal) |
||
161 | * supervisable = `yes/no` ; give right to the user to supervise a class |
||
162 | (only for group and portal) |
||
163 | * external_auth = login for external_auth (by cas or shiboleth for example). |
||
164 | Not useful for Moodle |
||
165 | * agreecgu = if yes, the user will not be asked when he enters |
||
9815 | obado | 166 | for the first time to agree the cgu |
13229 | obado | 167 | * regprop[1..5] = custom variables, upon to you |
168 | (i.e : you can set here an external group for example) |
||
23 | reyssat | 169 | |
170 | |||
13229 | obado | 171 | * **job=modclass** Modify the properties of a class. |
23 | reyssat | 172 | |
13229 | obado | 173 | `data1` should be a multi-line text containing the properties to be redefined. |
9815 | obado | 174 | Only modified properties need to be present in data1. |
23 | reyssat | 175 | |
391 | obado | 176 | |
13229 | obado | 177 | * **job=moduser** Modify the properties of a user. As modclass. |
23 | reyssat | 178 | |
13229 | obado | 179 | * **job=delclass** Delete a class. |
9691 | obado | 180 | |
13229 | obado | 181 | * **job=deluser** Delete a user. |
391 | obado | 182 | |
13229 | obado | 183 | * **job=recuser** Recover a deleted user. |
1373 | bpr | 184 | |
13229 | obado | 185 | * **job=getclass** Get the properties of a class. |
9815 | obado | 186 | |
187 | Optionally, the query parameter 'option' may contain the names of fields |
||
188 | queried. In this case, only the queried properties are returned. |
||
189 | |||
190 | Note: definitions for portals have beed added to output variables but are |
||
191 | not yet in addclass: |
||
192 | typename = |
||
193 | programs = |
||
194 | courses = |
||
195 | classes = |
||
196 | levels = |
||
197 | icourses = |
||
198 | subclasses = |
||
199 | |||
200 | |||
13229 | obado | 201 | * **job=getsheet** Get the properties of a sheet (of a class). |
9815 | obado | 202 | |
9691 | obado | 203 | Optionally, the query parameter 'option' may contain |
204 | the names of fields queried. In this case, only the |
||
205 | queried properties are returned. |
||
9689 | obado | 206 | |
9815 | obado | 207 | OUTPUT variables: |
208 | queryclass : the requested class |
||
209 | querysheet : the requested sheet |
||
13229 | obado | 210 | sheet_properties : list of properties of the requested sheet |
211 | (sheet status,expiration date,title,description) |
||
9815 | obado | 212 | exocnt : number of exercices included |
213 | exotitlelist : list of the exercices included (module:params) |
||
9691 | obado | 214 | |
9689 | obado | 215 | |
13229 | obado | 216 | * **job=listsheets** List all the sheets of a class. |
9691 | obado | 217 | |
9815 | obado | 218 | OUTPUT variables: |
219 | queryclass : the requested class |
||
220 | nbsheet : number of sheets in this class |
||
221 | sheettitlelist : list of the sheets with the format "sheet_id:title" |
||
1373 | bpr | 222 | |
223 | |||
13229 | obado | 224 | * **job=listclasses** List all the classes with connection between the `rclass` and `ident/rclass`. |
9815 | obado | 225 | |
226 | Optionally, the query parameter 'option' contains the name of fields related |
||
227 | to classes asked: |
||
228 | e.g. : option=description,supervisor |
||
229 | |||
230 | |||
13229 | obado | 231 | * **job=getclassesuser** List all the classes with connection between the rclass and |
232 | `ident/rclass` where the user exists. |
||
9815 | obado | 233 | |
234 | Optionally, the query parameter 'option' may contain the names of fields |
||
235 | queried. In this case, only the queried properties of the classes are |
||
236 | returned. |
||
237 | |||
238 | |||
13229 | obado | 239 | * **job=getuser** Get the properties of a user (of a class). |
9815 | obado | 240 | |
241 | Optionally, the query parameter 'option' may contain the names of fields |
||
242 | to be queried. In this case, only the queried properties are returned. |
||
9691 | obado | 243 | The output format is as for 'getclass'. |
391 | obado | 244 | |
9815 | obado | 245 | |
13229 | obado | 246 | * **job=getcsv** Get data of the class, under the form of a csv/tsv spreatsheet file. |
9815 | obado | 247 | |
9691 | obado | 248 | The query parameter 'format' may be used to specify the desired output format |
249 | (csv or tsv, defaults to csv). |
||
250 | The query parameter 'option' should contain a list of desired data columns. |
||
251 | The following names can be included in 'option', with their respective meanings: |
||
23 | reyssat | 252 | |
13229 | obado | 253 | * login : user identifiers |
254 | * password : user passwords (uncrypted) |
||
255 | * name : user names (last name and first name) |
||
256 | * lastname : user family names |
||
257 | * firstname : user given names |
||
258 | * email : user email addresses |
||
259 | * regnum : user registration numbers |
||
260 | * allscore : all score fields (averages and details) |
||
261 | * averages : score averages (average0, average1, average2) |
||
262 | * average0 : global score average (as computed by WIMS) |
||
263 | * average1 : average of scores automatically attributed by WIMS |
||
264 | * average2 : average of teacher-entered scores |
||
265 | * exams : exam1+exam2+... |
||
266 | * exam1, exam2, ...: scores of each exam |
||
267 | * sheets : sheet1+sheet2+... |
||
268 | * sheet1, sheet2, ...: scores of each worksheet |
||
269 | * manuals : manual1+manual2+... |
||
270 | * manual1, manual2, ...: first, second, ... teacher-entered scores. |
||
271 | |||
9691 | obado | 272 | The output content (below the status line in WIMS format) is a csv/tsv |
9689 | obado | 273 | spreadsheet table. The first row of the table contains |
274 | the names of the fields. The second row gives short |
||
275 | descriptions of each field. The third row is blank. |
||
276 | The rest is the table content, with one row for each user. |
||
23 | reyssat | 277 | |
278 | |||
13229 | obado | 279 | * **job=lightpopup** Presents an exercise without the top, bottom, and left menu |
9815 | obado | 280 | |
13229 | obado | 281 | The syntax is `job=lightpopup&emod=MODULE` where `MODULE` is an exercise module with its parameters. |
9815 | obado | 282 | option: |
13229 | obado | 283 | |
284 | * about : show "about" which gives author information about the |
||
9815 | obado | 285 | exercise (default) |
13229 | obado | 286 | * noabout : the "about" will not appear. |
9815 | obado | 287 | |
9691 | obado | 288 | SAMPLES REQUESTS : |
289 | |||
13229 | obado | 290 | * http://127.0.0.1/wims/wims.cgi?module=adm/raw&job=lightpopup&emod=H3%2Fanalysis%2Foeflinf.fr |
291 | * http://127.0.0.1/wims/wims.cgi?module=adm/raw&job=lightpopup&emod=H3%2Fanalysis%2Foeflinf.fr&parm=cmd=new;exo=antecedant;qnum=1;qcmlevel=3&option=noabout |
||
23 | reyssat | 292 | |
293 | |||
13229 | obado | 294 | * **job=putcsv** Put data into the class. |
295 | |||
296 | The data to put is sent as the value of the query parameter `data1`, in the |
||
9815 | obado | 297 | same format as for the query 'getcsv' above. And with the following |
298 | particularities: |
||
13229 | obado | 299 | Field `login` must be present. |
9815 | obado | 300 | The second row (short descriptions) is not necessary. |
301 | WIMS-attributed scores cannot be uploaded, and will be ignored. |
||
302 | If all the necessary fields corresponding to user properties (lastname, |
||
303 | firstname, password, etc.) are present, non-existent users will be |
||
304 | added to the class. This can be used to install the whole user accounts |
||
305 | of the class with one request. |
||
23 | reyssat | 306 | |
307 | |||
13229 | obado | 308 | * **job=getlog** Get the detailed activity registry of a user. |
9689 | obado | 309 | |
310 | |||
13229 | obado | 311 | * **job=gettime** Get the current time of the server |
312 | |||
9815 | obado | 313 | Can be used for synchronization purposes. |
314 | |||
315 | |||
13229 | obado | 316 | * **job=update** Ask WIMS to update data in a class. |
9815 | obado | 317 | |
318 | Upon reception of this request, WIMS server will issue queries back to the |
||
319 | remote server, in order to get the up-to-date information and update the |
||
320 | class. |
||
321 | The query parameter 'option' contains the nature of the update request. |
||
322 | It may be one of the following: |
||
323 | |||
13229 | obado | 324 | * class : update class properties (corresponding to modclass) |
325 | * user : update properties of a user (moduser) |
||
326 | * scores : teacher-entered scores (putcsv) |
||
9815 | obado | 327 | |
328 | |||
13229 | obado | 329 | * **job=authuser** Get an authentification for a user. |
330 | |||
9691 | obado | 331 | User's password is not required. |
13229 | obado | 332 | Accepts the query parameter `option=hashlogin`: |
9815 | obado | 333 | If called with option=hashlogin, quser should be the external |
334 | identification of user and the function hashlogin is called to convert |
||
335 | such id to a WIMS login. If the user exists in class, it returns a |
||
336 | session number as above. If the user does not exists, the WIMS login is |
||
337 | returned in the error message. |
||
9689 | obado | 338 | |
9691 | obado | 339 | OUTPUT : |
13229 | obado | 340 | |
341 | * wims_session : a session number under which the user can connect |
||
9815 | obado | 342 | with no need of further authentification |
13229 | obado | 343 | * home_url : a complete URL to connect as authentified. |
9691 | obado | 344 | |
5453 | czzmrn | 345 | |
13229 | obado | 346 | * **job=addsheet** Add a new sheet to the specified class `qclass`. |
9815 | obado | 347 | |
13229 | obado | 348 | `data1` may be defined as a multi-line text defining the sheet defs |
9691 | obado | 349 | The following names may be present in the definitions: |
9815 | obado | 350 | (mandatory) |
351 | (optional) |
||
1702 | georgesk | 352 | |
13229 | obado | 353 | * title = name of the sheet (defaults to "sheet n#") |
354 | * description = description of the sheet (defaults to "sheet n#") |
||
355 | * expiration = expiration date (yyyymmdd) defaults to one year later |
||
356 | * sheetmode = the mode of the sheet: |
||
357 | * 0 : pending (default) |
||
358 | * 1 : active |
||
359 | * 2 : expired |
||
360 | * 3 : expired + hidden |
||
361 | * weight = weight of the sheet in class score |
||
362 | * formula = How the score is calculated for this sheet (0 to 6) |
||
363 | * indicator = what indicator will be used in the score formula (0 to 2) |
||
364 | * contents = the contents for the multi-line file to be created. |
||
365 | The semicolons (;) in this parameter will be |
||
366 | interpreted as new lines. Equal characters (=) must |
||
367 | be replaced by the character AT (@). |
||
368 | There is no check made, so the integrity of the |
||
369 | contents is up to you only! (defaults to "") |
||
23 | reyssat | 370 | |
13229 | obado | 371 | **OUTPUT** : |
391 | obado | 372 | |
13229 | obado | 373 | * queryclass : the requested class |
374 | * sheet_id : id of the new created sheet |
||
4118 | obado | 375 | |
13229 | obado | 376 | |
377 | * **job=addexam** Add a new exam to the specified class `qclass`. |
||
378 | `data1` may be defined as a multi-line text defining the sheet defs, with the same parameters as in addsheet (see above), plus these additional optional parameters: |
||
379 | |||
380 | * duration = exam duration |
||
381 | * attempts = number of authorized attempts |
||
382 | * cut_hours = Cut hours (format : `yyyymmdd.hh:mm` (separate several hours by spaces). |
||
383 | * opening = Opening Restrictions (IP ranges / Schedules) opening can set a time restriction for recording notes by adding the words > yyyymmdd.hh:mm (start) and/or < yyyymmdd.hh:mm (end). Dates and times must be in server local time and must be separated by spaces. |
||
384 | |||
385 | |||
386 | * **job=addexo** Add the source file (data1) of an exercise directly to the class, under the name `qexo` |
||
387 | |||
388 | |||
389 | * **job=putexo** Add content (an existing exercise) to the sheet `qsheet` of the `qclass` class |
||
390 | `data1` may be defined as a multi-line text defining the exo defs, according to these parameters: |
||
391 | * **mandatory:** |
||
392 | * module = the module where comes the erexercice from |
||
393 | * **optional** |
||
394 | * params = list of parameters to add to the module |
||
395 | * points = number of requested points |
||
396 | * weight = Weight of the exercise |
||
397 | * title = title of the exercise in the sheet |
||
398 | * description = description of the exercise in the sheet |
||
399 | |||
400 | |||
401 | * **job=modsheet** Modify an existing sheet in the specified class. |
||
402 | |||
403 | `data1` may be defined as a multi-line text defining the sheet defs |
||
9815 | obado | 404 | (cf addsheet) |
4118 | obado | 405 | |
9815 | obado | 406 | |
13229 | obado | 407 | * **job=listexos** Lists all exercices presents in class `qclass` |
9689 | obado | 408 | |
9815 | obado | 409 | |
13229 | obado | 410 | * **job=movexo** Moves exercice `qexo` from class `qclass` to class `data1` |
4118 | obado | 411 | |
13229 | obado | 412 | Condition : Both 2 classes must be linked by `rclass` |
9815 | obado | 413 | |
13229 | obado | 414 | *option*: you can use `copy` to copy file instead of moving it. |
4118 | obado | 415 | |
416 | |||
13229 | obado | 417 | * **job=movexos** Moves ALL exercice from class `qclass` to class `data1` |
4118 | obado | 418 | |
13229 | obado | 419 | Condition: Both 2 classes must be linked by `rclass` |
420 | *option*: you can use `copy` to copy files instead of moving them. |
||
4626 | obado | 421 | |
13229 | obado | 422 | |
423 | * **job=sharecontent** declare neighbour classes, allowing class "qclass" to share content with class "data1" |
||
424 | |||
425 | Condition: Both 2 classes must be linked by `rclass` |
||
426 | The `option` parameter can be used to declare which type of content to share |
||
9815 | obado | 427 | (currently, only the "exo" content type is supported) |
4629 | obado | 428 | |
9815 | obado | 429 | |
13229 | obado | 430 | * **job=linksheet** Add all exercices from sheet `qsheet` to exam `qexam` |
9815 | obado | 431 | |
432 | |||
13229 | obado | 433 | * **job=getscore** Get all scores from user `quser` (optionaly, you can filter with sheet `qsheet`) |
9815 | obado | 434 | |
9896 | obado | 435 | |
13229 | obado | 436 | * **job=getsheetscores** Get all scores from sheet `qsheet` - JSON OUTPUT only |
9896 | obado | 437 | |
13229 | obado | 438 | |
439 | * **job=getexamscores** Get all scores from exam `qexam` - JSON OUTPUT only |
||
440 | |||
441 | --- |