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