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)
Example 2 (upload of multiple files)