Subversion Repositories wimsdev

Rev

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