Child pages
  • openBIS Application Server Upload Service
Skip to end of metadata
Go to start of metadata

openBIS application server provides an HTTP based upload service that can be used to send a single or multiple files at once to the application server session workspace folder. The uploaded files can be later on used e.g. in V3 API import methods to create/update experiments/samples/datasets/materials.

Upload service is available at "/openbis/upload" url. It expects HTTP multipart requests. Each request must contain:

  • "sessionID" - session token that represents a valid openBIS session. Basing on that token a user specific session workspace folder is found where the uploaded files will be stored
  • "sessionKeysNumber" - a number of session keys to be used. Normally, if we just want to upload a single file this parameter should be set to "1". In more complicated cases this parameter can be set to a higher value, e.g. "2", "3" etc. For instance, if we wanted to upload one file with experiments and another file with samples and then import these files via V3 API, then we would set "sessionKeysNumber" parameter to "2". One session key would be used to store the experiments file and the other session key to store the samples file. Having the dedicated session keys allows us to refer to the uploaded files later on e.g. in V3 API import methods (import methods require a session key of a file to be imported).
  • "sessionKey_0", "sessionKey_1", ... - depending on the "sessionKeysNumber" value, a corresponding number of "sessionKey_XXX" request parameters must be also set. For instance, if "sessionKeysNumber" is "1" then only "sessionKey_0" must be set. If "sessionKeysNumber" is "2" then "sessionKey_0" and "sessionKey_1" must be set etc. Each "sessionKey_XXX" parameter value serves two purposes:
    • it defines a session key for the uploaded file (i.e. a name that can be used to refer to that file later on)
    • it defines the uploaded file request parameter prefix (e.g. if "sessionKey_0" is set to "hello_world" then a name of a request parameter that contains the uploaded file must start with "hello_world" prefix)


Example 1 (upload of a single file)

Single file upload form
<form id="uploadForm" method="post" action="/openbis/upload" enctype="multipart/form-data">
	<input type="file" name="myFile">
	<input type="hidden" name="sessionID" value="test-180528214934976x7D52C68109A8DFCEDDF8806FD88D5B59">
	<input type="hidden" name="sessionKeysNumber" value="1">
	<input type="hidden" name="sessionKey_0" value="myFile">
	<input type="submit">
</form>


Example 2 (upload of multiple files)

Multiple files upload form
<form id="uploadForm" method="post" action="/openbis/upload" enctype="multipart/form-data">
	<input type="file" name="firstFile">
	<input type="file" name="secondFile">
	<input type="hidden" name="sessionID" value="test-180528214934976x7D52C68109A8DFCEDDF8806FD88D5B59">
	<input type="hidden" name="sessionKeysNumber" value="2">
	<input type="hidden" name="sessionKey_0" value="firstFile">
	<input type="hidden" name="sessionKey_1" value="secondFile">
	<input type="submit">
</form>
  • No labels