File: adm-raw.md

package info (click to toggle)
wimsapi 0.5.11-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 564 kB
  • sloc: python: 3,096; makefile: 16
file content (485 lines) | stat: -rw-r--r-- 18,100 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
# Protocol for WIMS direct connection with other web servers

WIMS direct communication with another web server is two-directional.
It can receive http/https requests from the other server, and/or send http/https requests to the other.
The connectable server must be declared in a file
within the directory `WIMS_HOME/log/classes/.connections/`.

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.

Outgoing requests sent by WIMS can be formatted according to the
specification of the receiving software,
while the result of the request should be formatted according to the need of WIMS, as described below.

_________________________________________________________________
## Request format

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.

All requests must contain the following common parameters:

---
| Name   | Value                      |
|--------|----------------------------|
| module | adm/raw |
| ident  | sender identifier (a word, according to the definition in `WIMS_HOME/log/classes/.connections/`) |
| passwd | sender password (as defined in `WIMS_HOME/log/classes/.connections/`) |
| 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. |
| job    | type of request, see below. |



 And the following parameters may be added according to the type
of the request.

| Name     | Value                      |
|----------|----------------------------|
| qclass   | identifier of the class on the receiving server. It should be an integer. |
| qprogram |  	|
| quser    | user identifier in the receiving server (when the request concerns a particular user). 	|
| qsheet   | sheet identifier in the receiving server (when the request concerns a particular sheet). 	|
| rclass   | identifier of the class on the sending server. |
| format   | Format of the data. |
| option   | Different meaning according to request. |
| data1    | Different meaning according to request. |


For example, the following request checks whether the class `12345` exists on
the WIMS server `wims.unice.fr`, sent by a connecting server called `friend1` (by
wims.unice.fr), with password `abcde`.

`https://wims.unice.fr/wims/wims.cgi?module=adm/raw&ident=friend1&passwd=abcde&code=afdqreaf1r783&job=checkclass&qclass=12345&rclass=myclass`

Note that for this check to return OK, the class `12345` on wims.unice.fr must
have declared `friend1/myclass` as connectable.
This can be done on an existing class by adding `friend1/myclass` to the `class_connections` parameter in the class `12345` .def file.

_______________________________________________________________________________

## Query output

The query output (that is, the result of the http query) is always of
text/plain type (even if sometimes the output is a binary file).

**WIMS OUTPUT TYPE** : (old fashioned way, non-recommended)
    The first line of the output content is a status line, which is either a
    word OK followed by the random code contained in the request, or the
    word ERROR. If the first line is not as such, then there is a
    serious error in the request or a bug in the server software.
    In case the status is OK, the remaining of the output content is the
    content of the data. Otherwise the second line contains the nature of
    the error.

**JSON OUTPUT TYPE** : (recommended)
    output values are returned json formatted. (see [http://json.org]() for more
    details)
_______________________________________________________________________________

## Types of the requests.

A request to WIMS can have the following types (defined by the parameter 'job')

### job=help
    Show this text.

### job=checkident
    Check whether the connection is accepted.

### job=checkclass
    Check whether the class accepts connection.

### job=checkuser
    Check whether the user exists.

### job=checksheet
    Check whether the sheet exists.

### job=addclass
    Add a class on the receiving server.

For this request, `data1` should be a multi-line text defining the
properties of the new class. Each line contains a definition in the format
`name=value`. (This text must be reformatted for http query string)
The following names may be present in the definitions:

* **mandatory:**
	* description     = name of the class
	* institution     = name of the institution
	* supervisor      = full name of the supervisor
	* email           = contact email address
	* password        = password for user registration
	* lang            = class language (en, fr, es, it, etc)
* **optional:**
	* expiration      = class expiration date (yyyymmdd)
							(optional, defaults to one year later)
	* limit           = limit of number of participants
	                    (optional, defaults to 30)
	* level           = level of the class (optional, defaults to H4)
	                    Valid levels: E1, E2, ..., E6, H1, ..., H6,
			                           U1, ..., U5, G, R
	* secure          = secure hosts
	* bgcolor         = page background color
	* refcolor        = menu background color
	* css             = css file (must be existing css on the WIMS server)

`data2` should be a multi-line text defining the supervisor account, in the
same format as for data1.
The following names may be present in the definitions:

* **mandatory:**
	* lastname        = last name of the supervisor user
	* firstname       = first name of the supervisor user
	* password        = supervisor user's password, non-crypted.
* **optional**
	* email           = supervisor email address
	* comments        = any comments
	* regnum          = registration number
	* photourl        = url of a user picture
	* participate     = list classes (if in a class group) where user participates
	* courses         =
	* classes         =
	* supervise       =
	* supervisable    =
	* external_auth   =
	* agreecgu        = Boolean indicating if user accepted CGU
	* regprop[1..5]   = custom properties


### job=adduser
    Add a user to the specified class.

`data1` should be a multi-line text defining the user account.
The following names may be present in the definitions:

* **mandatory:**
	* lastname        = user's lastname
	* firstname       = user's firstname
	* password        = user's password, non-crypted.
* **optional**
	* email           = email address
	* comments        = any comments
	* regnum          = registration number
	* photourl        = url of user’s photo
	* participate     = list classes where user participates
                          (only for group and portal)
	* courses         = special for portal
	* classes         = special for portal
	* supervise       = List classes where teacher are administator
                          (only for group and portal)
	* supervisable    = `yes/no` ; give right to the user to supervise a class
                          (only for group and portal)
	* external_auth   = login for external_auth (by cas or shiboleth for example).
                          Not useful for Moodle
	* agreecgu        = if yes, the user will not be asked when he enters
                          for the first time to agree the cgu
	* regprop[1..5]   = custom variables, upon to you
                          (i.e : you can set here an external group for example)


### job=modclass
    Modify the properties of a class.

`data1` should be a multi-line text containing the properties to be redefined.
Only modified properties need to be present in data1.


### job=moduser
    Modify the properties of a user. As modclass.

### job=delclass
    Delete a class.

### job=deluser
    Delete a user.

### job=recuser
    Recover a deleted user.

### job=getclass
    Get the properties of a class.

Optionally, the query parameter 'option' may contain the names of fields
queried. In this case, only the queried properties are returned.

**Note**: definitions for portals have beed added to output variables but are not yet in addclass:

    typename            =
    programs            =
    courses             =
    classes             =
    levels              =
    icourses            =
    subclasses          =


### job=getsheet
    Get the properties of a sheet (of a class).

Optionally, the query parameter 'option' may contain
the names of fields queried. In this case, only the
queried properties are returned.

OUTPUT variables:

    queryclass          : the requested class
    querysheet          : the requested sheet
    sheet_properties    : list of properties of the requested sheet
                          (sheet status,expiration date,title,description)
    exocnt              : number of exercices included
    exotitlelist        : list of the exercices included (module:params)


### job=listsheets
    List all the sheets of a class.

OUTPUT variables:

    queryclass       : the requested class
    nbsheet          : number of sheets in this class
    sheettitlelist   : list of the sheets with the format "sheet_id:title"


### job=listclasses
    List all the classes with connection between the `rclass` and `ident/rclass`.

Optionally, the query parameter 'option' contains the name of fields related
to classes asked:
    e.g. : option=description,supervisor


### job=getclassesuser
    List all the classes with connection between the rclass and `ident/rclass` where the user exists.

Optionally, the query parameter 'option' may contain the names of fields
queried. In this case, only the queried properties of the classes are
returned.


### job=getuser
    Get the properties of a user (of a class).

Optionally, the query parameter 'option' may contain the names of fields
to be queried. In this case, only the queried properties are returned.
The output format is as for 'getclass'.


### job=getcsv
    Get data of the class, under the form of a csv/tsv spreatsheet file.

The query parameter 'format' may be used to specify the desired output format
(csv or tsv, defaults to csv).
The query parameter 'option' should contain a list of desired data columns.
The following names can be included in 'option', with their respective meanings:

* login       : user identifiers
* password    : user passwords (uncrypted)
* name        : user names (last name and first name)
* lastname    : user family names
* firstname   : user given names
* email       : user email addresses
* regnum      : user registration numbers
* allscore    : all score fields (averages and details)
* averages    : score averages (average0, average1, average2)
* average0    : global score average (as computed by WIMS)
* average1    : average of scores automatically attributed by WIMS
* average2    : average of teacher-entered scores
* exams       : exam1+exam2+...
* exam1, exam2, ...: scores of each exam
* sheets      : sheet1+sheet2+...
* sheet1, sheet2, ...: scores of each worksheet
* manuals     : manual1+manual2+...
* manual1, manual2, ...: first, second, ... teacher-entered scores.

        The output content (below the status line in WIMS format) is a csv/tsv
        spreadsheet table. The first row of the table contains
        the names of the fields. The second row gives short
        descriptions of each field. The third row is blank.
        The rest is the table content, with one row for each user.


### job=lightpopup
    Presents an exercise without the top, bottom, and left menu

   The syntax is `job=lightpopup&emod=MODULE` where `MODULE` is an exercise module with its parameters.

   option:

   * about       : show "about" which gives author information about the exercise (default)
   * noabout     : the "about" will not appear.

   SAMPLES REQUESTS:

   * H3/analysis/oeflinf.fr intro in lightpopup mode:
     * [http://127.0.0.1/wims/wims.cgi?module=adm/raw&job=lightpopup&emod=H3%2Fanalysis%2Foeflinf.fr]()

   * "antecedant" exercice from H3/analysis/oeflinf.fr module in lightpopup mode:
     * [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]()


### job=putcsv
    Put data into the class.

The data to put is sent as the value of the query parameter `data1`, in the
same format as for the query `getcsv` above. And with the following
particularities:
    Field `login` must be present.
    The second row (short descriptions) is not necessary.
    WIMS-attributed scores cannot be uploaded, and will be ignored.
    If all the necessary fields corresponding to user properties (lastname,
    firstname, password, etc.) are present, non-existent users will be
    added to the class. This can be used to install the whole user accounts
    of the class with one request.


### job=getlog
    Get the detailed activity registry of a user.


### job=gettime
    Get the current time of the server

    Can be used for synchronization purposes.


### job=update
    Ask WIMS to update data in a class.

Upon reception of this request, WIMS server will issue queries back to the
remote server, in order to get the up-to-date information and update the
class.
The query parameter 'option' contains the nature of the update request.
It may be one of the following:

	* class       : update class properties (corresponding to modclass)
	* user        : update properties of a user (moduser)
	* scores      : teacher-entered scores (putcsv)


### job=authuser
    Get an authentification for a user.

User's password is not required.
Accepts the query parameter `option=hashlogin`:
    If called with option=hashlogin, `quser` should be the external
    identification of user and the function hashlogin is called to convert
    such id to a WIMS login. If the user exists in class, it returns a
    session number as above. If the user does not exists, the WIMS login is
    returned in the error message.

    OUTPUT :

	* wims_session    : a session number under which the user can connect
                          with no need of further authentification
	* home_url        : a complete URL to connect as authentified.


### job=addsheet
    Add a new sheet to the specified class `qclass`.

`data1` may be defined as a multi-line text defining the sheet defs
The following names may be present in the definitions:

**(optional)**

	* title       = name of the sheet (defaults to "sheet n#")
	* description = description of the sheet (defaults to "sheet n#")
	* expiration  = expiration date (yyyymmdd) defaults to one year later
	* sheetmode   = the mode of the sheet:
		* 0 : pending (default)
		* 1 : active
		* 2 : expired
		* 3 : expired + hidden
	* weight      = weight of the sheet in class score
	* formula     = How the score is calculated for this sheet (0 to 6)
	* indicator   = what indicator will be used in the score formula (0 to 2)
	* contents    = the contents for the multi-line file to be created.
	                  The semicolons (;) in this parameter will be
	                  interpreted as new lines. Equal characters (=) must
	                  be replaced by the character AT (@).
	                  There is no check made, so the integrity of the
	                  contents is up to you only! (defaults to "")

**OUTPUT** :

	* queryclass  : the requested class
	* sheet_id    : id of the new created sheet


### job=addexam
    Add a new exam to the specified class `qclass`.
`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:

* duration   = exam duration
* attempts   = number of authorized attempts
* cut_hours  = Cut hours (format : `yyyymmdd.hh:mm` (separate several hours by spaces).
* 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.


### job=addexo
    Add the source file (data1) of an exercise directly to the class, under the name `qexo`


### job=putexo
    Add content (an existing exercise) to the sheet `qsheet` of the `qclass` class
`data1` may be defined as a multi-line text defining the exo defs, according to these parameters:

* **mandatory**
	* module        = the module where comes the erexercice from
* **optional**
	* params        = list of parameters to add to the module
	* points        = number of requested points
	* weight        = Weight of the exercise
	* title         = title of the exercise in the sheet
	* description   = description of the exercise in the sheet


### job=modsheet
    Modify an existing sheet in the specified class.

`data1` may be defined as a multi-line text defining the sheet defs
(cf addsheet)


### job=listexos
    Lists all exercices presents in class `qclass`


### job=movexo
    Moves exercice `qexo` from class `qclass` to class `data1`

Condition : Both 2 classes must be linked by `rclass`

*option*: you can use `copy` to copy file instead of moving it.


### job=movexos
    Moves ALL exercice from class `qclass` to class `data1`

Condition: Both 2 classes must be linked by `rclass`

*option*: you can use `copy` to copy files instead of moving them.


### job=sharecontent
    Declare neighbour classes, allowing class "qclass" to share content with class "data1"

Condition: Both 2 classes must be linked by `rclass`

The `option` parameter can be used to declare which type of content to share
(currently, only the "exo" content type is supported)


### job=linksheet
    Add all exercices from sheet `qsheet` to exam `qexam`


### job=getscore
    Get all scores from user `quser` (optionaly, you can filter with sheet `qsheet`)


### job=getsheetscores
    Get all scores from sheet `qsheet` - JSON OUTPUT only


### job=getexamscores
    Get all scores from exam `qexam`   - JSON OUTPUT only