Subversion Repositories wimsdev

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
23 reyssat 1
<pre>
2
 
3
	Protocol for WIMS direct connection with other web servers
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
 
391 obado 18
_____________________________________________________________________________
19
 
23 reyssat 20
			Request format
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
---------------------------------------
29
 Name		Value
30
---------------------------------------
31
module		adm/raw
32
ident		sender identifier (a word, according to the definition
33
		in WIMS_HOME/log/classes/.connections/)
34
passwd		sender password (as defined in 
35
		WIMS_HOME/log/classes/.connections/)
36
code		a random word. This word will be sent back to the sender,
37
		in order to allow it to check whether the result is from
38
		the good request.
39
job		type of request, see below.
40
---------------------------------------------
41
 
42
And the following parameters may be added according to the type
43
of the request.
44
 
45
---------------------------------------
46
 Name		Value
47
---------------------------------------
48
qclass		identifier of the class on the receiving server.
49
		It should be an integer.
1211 bpr 50
qprogram
23 reyssat 51
quser		user identifier in the receiving server (when the request
52
		concerns a particular user).
391 obado 53
qsheet		sheet identifier in the receiving server (when the request
54
		concerns a particular sheet).
23 reyssat 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.
60
---------------------------------------------
61
 
62
For example, the following request checks whether the class '12345' exists
63
on the WIMS server wims.unice.fr, sent by a connecting server called 'friend1'
64
(by wims.unice.fr), with password 'abcde'.
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
 
71
____________________________________________________________________________
72
 
73
			Query output
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
The first line of the output content is a status line, which is either a
78
word OK followed by the random code contained in the request, or the
79
word ERROR. If the first line is not as such, then there is a
80
serious error in the request or a bug in the server software.
81
 
82
In case the status is OK, the remaining of the output content is the
83
content of the data. Otherwise the second line contains the nature of
84
the error.
85
 
86
___________________________________________________________________________
87
 
88
			Types of the requests.
89
 
90
A request to WIMS can have the following types (defined by the parameter
91
'job').
92
 
93
job=help	Show this text.
94
 
95
job=checkident	Check whether the connection is accepted. No output except
96
		the status line.
97
 
98
job=checkclass	Check whether the class accepts connection. No output except
99
		the status line.
100
 
101
job=checkuser	Check whether the user exists. No output except the status
102
		line.
103
 
391 obado 104
job=checksheet	Check whether the sheet exists. No output except the status
105
		line.
106
 
23 reyssat 107
job=addclass	Add a class on the receiving server. For this request,
108
		'data1' should be a multi-line text defining the properties
109
		of the new class. Each line contains a definition
110
		in the format 'name=value'. (Of course, this text
111
		must be reformatted for http query string.)
112
		The following names may be present in the definitions:
113
	description	= name of the class (mandatory)
114
	institution	= name of the institution (mandatory)
115
	supervisor	= full name of the supervisor (mandatory)
116
	email		= supervisor email address (mandatory)
117
	password	= password for user registration (mandatory)
118
	lang		= class language (en, fr, es, it, etc) (mandatory)
119
	expiration	= class expiration date (yyyymmdd)
120
			  (optional, defaults to one year later)
121
	limit		= limit of number of participants
122
			  (optional, defaults to 30)
123
	level		= level of the class (optional, defaults to H4)
124
			  Valid levels: E1, E2, ..., E6, H1, ..., H6,
125
			  U1, ..., U5, G, R
126
	secure		= secure hosts (optional)
127
	bgcolor		= page background color
128
	refcolor	= menu background color
129
	css		= css file (must be existing css on the WIMS server)
130
 
131
		Moreover, 'data2' should be a multi-line text defining
132
		the supervisor account, in the same format as for
133
		data1. The following names may be present in
134
		the definitions:
135
	lastname	(mandatory)
136
	firstname	(mandatory)
137
	password	= user's password, non-crypted. (mandatory)
138
	email		= email address (optional)
139
	comments	= any comments (optional)
140
	regnum		= registration number (optional)
141
 
142
		There is no output data except the status line.
143
 
144
job=adduser	Add a user to the specified class. 'data1' should be a
145
		multi-line text defining the user account, with names
146
		as in 'addclass'.
147
		There is no output data except the status line.
148
 
149
job=modclass	Modify the properties of a class. 'data1' should be
150
		a multi-line text containing the properties to be
151
		redefined. Only modified properties need to be 
152
		present in data1.
153
		There is no output data except the status line.
154
 
155
job=moduser	Modify the properties of a user. As modclass.
156
		There is no output data except the status line.
157
 
158
job=delclass	Delete a class.
159
		There is no output data except the status line.
160
 
161
job=deluser	Delete a user.
162
		There is no output data except the status line.
163
 
164
job=recuser	Recover a deleted user.
165
		There is no output data except the status line.
166
 
167
job=getclass	Get the properties of a class.
391 obado 168
 
23 reyssat 169
		Optionally, the query parameter 'option' may contain
170
		the names of fields queried. In this case, only the
171
		queried properties are returned.
391 obado 172
		If the output type is WIMS,
173
		it outputs a multi-line text, each line corresponding
23 reyssat 174
		to one definition in the format 'name=value', as
175
		for the input format for 'addclass'.
1211 bpr 176
		Definitions for portals have beed added (not yet in addclass) :
177
		  typename 
178
	      programs
179
	      courses
180
	      classes
181
	      levels
182
	      icourses
183
	      subclasses
391 obado 184
 
185
job=getsheet	Get the properties of a sheet (of a class).
23 reyssat 186
 
391 obado 187
		Optionally, the query parameter 'option' may contain
188
		the names of fields queried. In this case, only the
189
		queried properties are returned.
190
	 	If the output type is WIMS, output is a multi-line text, each line corresponding
191
		to one definition in the format 'name=value', with these names : 
192
	queryclass : the requested class
193
	querysheet : the requested sheet
194
	sheet_properties : list of properties of the requested sheet (sheet status,expiration date,title,description)
1211 bpr 195
	exocnt : number of exercices included
196
	exotitlelist= list of the exercices included (module:params)
391 obado 197
 
198
job=listsheets	list all the sheets of a class.
199
	 	If the output type is WIMS, output is a multi-line text, each line corresponding
200
		to one definition in the format 'name=value', with these names : 
201
	queryclass : the requested class
202
	nbsheet : number of sheets in this class
203
	sheettitlelist=list of the sheets with the format "sheet_id:title"
1373 bpr 204
 
205
job=listclasses list all the classes with connection between the rclass and
206
$ident/$rclass.
207
    Optionally, the query parameter 'option' contains the name of fields related to classes asked :
208
    module=adm/raw&ident=$ident&passwd=....&code=abcde&job=listclasses&option=description,supervisor&rclass=$rclass
209
 
210
job=getclassesuser list all the classes with connection between the rclass and
211
$ident/$rclass where the user exists.
212
   Optionally, the query parameter 'option' may contain
213
  the names of fields queried. In this case, only the
214
  queried properties of the classes are returned.
215
 
23 reyssat 216
job=getuser	Get the properties of a user (of a class).
391 obado 217
 
23 reyssat 218
		Optionally, the query parameter 'option' may contain
219
		the names of fields queried. In this case, only the
220
		queried properties are returned.
221
		The output format is as for 'getclass'.
222
 
223
job=getcsv	Get data of the class, under the form of a csv/tsv 
224
		spreatsheet file. The query parameter 'format' may be
225
		used to specify the desired output format (csv or tsv,
226
		defaults to csv).
227
		The query parameter 'option' should contain a list of
228
		desired data columns. The following names can be included
229
		in 'option', with their respective meanings:
230
	login		user identifiers
231
	password	user passwords (uncrypted)
232
	name		user names (last name and first name)
233
	lastname	user family names
234
	firstname	user given names
235
	email		user email addresses
236
	regnum		user registration numbers
237
	allscore	all score fields (averages and details)
238
	averages	score averages (average0, average1, average2)
239
	average0	global score average (as computed by WIMS)
240
	average1	average of scores automatically attributed by WIMS
241
	average2	average of teacher-entered scores
242
	exams		exam1+exam2+...
243
	exam1, exam2, ...
244
			scores of each exam
245
	sheets		sheet1+sheet2+...
246
	sheet1, sheet2, ...
3954 bpr 247
			scores of each worksheet
23 reyssat 248
	manuals		manual1+manual2+...
249
	manual1, manual2, ...
250
			first, second, ... teacher-entered scores.
251
 
252
		The output content (below the status line) is a csv/tsv
253
		spreadsheet table. The first row of the table contains
254
		the names of the fields. The second row gives short
255
		descriptions of each field. The third row is blank.
256
		The rest is the table content, with one row for each user.
257
 
2763 bpr 258
job=lightpopup with query parameter 'emod'.
259
     presents an exercise without the top, bottom, and left menu except for the 
260
    "about". The syntax is job=lightpopup&emod=$module where $module is a exercise module
261
    with its parameters. 
262
 
2976 bpr 263
    http://127.0.0.1/wims/wims.cgi?module=adm/raw&job=lightpopup&emod=H3%2Fanalysis%2Foeflinf.fr
264
    option : noabout (the "about" which gives author information about the exercise will not appear).
265
             about (default)
3286 bpr 266
http://127.0.0.1/wims/wims.cgi?module=adm/raw&job=lightpopup&emod=H3%2Fanalysis%2Foeflinf.fr&parm=exo=antecedant;qnum=1;qcmlevel=3&option=noabout
2976 bpr 267
 
23 reyssat 268
job=putcsv	Put data into the class. The data to put is sent as the
269
		value of the query parameter 'data1', in the same format
270
		as for the query 'getcsv' above. And with the following
271
		particularities:
272
	Field 'login' must be present.
273
	The second row (short descriptions) is not necessary.
274
	WIMS-attributed scores cannot be uploaded, and will be ignored.
275
	If all the necessary fields corresponding to user properties
276
		(lastname, firstname, password, etc.) are present,
277
		non-existent users will be added to the class. This
278
		can be used to install the whole user accounts of
279
		the class with one request.
280
 
281
		There is no output data except the status line.
282
 
283
job=getlog	Get the detailed activity registry of a user. The 
284
		output is in WIMS internal format.
285
 
286
job=gettime	Get the current time of the server, can be used for
287
		synchronization purposes.
288
		The output can be formatted according to the desire
289
		of the querying software.
290
 
291
job=update	Ask WIMS to update data in a class. Upon reception of
292
		this request, WIMS server will issue queries back to
293
		the remote server, in order to get the up-to-date
294
		information and update the class.
295
		The query parameter 'option' contains the nature of
296
		the update request. It may be one of the following:
297
	class	update class properties (corresponding to modclass)
298
	user	update properties of a user (moduser)
299
	scores	teacher-entered scores (putcsv)
300
 
301
		There is no output data except the status line.
302
 
303
job=authuser	Get an authentification for a user. The password of
304
		the user is not required.
305
		The output content is either a session number under
306
		which the user can connect with no need of further
307
		authentification (format for WIMS), or a complete
308
		URL to connect as authentified.
309
 
5453 czzmrn 310
		Accept the query parameter 'option=hashlogin': 
311
        hashlogin if called with option=hashlogin, quser should be the
312
                external identification of user and the function
5473 czzmrn 313
                hashlogin is called to convert such id to a WIMS
5453 czzmrn 314
                login. If the user exists in class, it returns a
315
                session number as above. If the user does not exists,
316
                the WIMS login is returned in the error message.
317
 
1702 georgesk 318
job=addsheet 	Add a new sheet to the specified class. 'data1' may be defined as a
391 obado 319
		multi-line text defining the sheet defs
320
		The following names may be present in the definitions:
1702 georgesk 321
	title	        = name of the sheet (optional, defaults to "sheet n#")
391 obado 322
	description	= description of the sheet (optional, defaults to "sheet n#")
323
	expiration	= class expiration date (yyyymmdd) (optional, defaults to one year later)
1702 georgesk 324
        sheetmode       = the mode of the sheet [0 = in preparation, 1 = active, 2 = ?, 3 = expired + hidden] (optional, defaults to 0)
325
        contents        = the contents for the multi-line file to be created. The semicolons (;) in this parameter
326
                          will be interpreted as new lines. Equal characters (=) must be replaced by the character AT (@).
327
                          There is no check made, so the integrity of the contents is up to you only! (optional, defaults to "")
328
 
391 obado 329
	 	If the output type is WIMS, output is a multi-line text, each line corresponding
330
		to one definition in the format 'name=value', with these names : 
331
	queryclass : the requested class
332
	sheet_id : id of the new created sheet
23 reyssat 333
 
391 obado 334
 
4118 obado 335
 
336
job=listexos		permet de lister tous les exercices presents dans la classe qclass
337
 
338
job=movexo			permet de deplacer l'exercice qexo de la classe qclass a la classe data1, a condition que les 2 classes soient liees a rclass
339
# option peut contenir le mot "copy" pour copier le fichier au lieu de le deplacer.
340
 
341
job=movexos			permet de deplacer l'ensemble des exercices de la classe qclass vers la classe data1, a condition que les 2 classes soient liees a rclass
342
# option peut contenir le mot "copy" pour copier les fichiers au lieu de les deplacer.
343
 
344
job=sharecontent	permet de declarer des classes voisines, et de partager des contenus d'une classe "qclass" avec une classe "data1", a condition que les 2 classes soient liees a "rclass"
345
"option" va contenir le type de contenu à partager. (pour le moment, seul "exo" est pris en compte)
346
 
4626 obado 347
job=linksheet		adds all exercices from sheet $qsheet to exam $qexam
4118 obado 348
 
4626 obado 349
job=getsheetscores  gets all score from sheet $qsheet - JSON only
350
 
4629 obado 351
job=getexamscores   gets all score from exam $qexam - JSON only
352
 
1211 bpr 353
</pre>