4.4.2 Creating a data file set with multiple files in a single request
As an alternative to creating the data file set in the 'conversational' mode,
the data file sets endpoint offers the client the ability to create a data file
set with one or more data files, together with the file contents, in one
request.
This feature requires the client to POST a so called multipart request message
that contains the following parameters:
- The "dataFileSetCode" that contains the unique code for the data file set that will be created.
- One or more "file" parameters that contain the file contents along with file metadata.
Multipart requests can be constructed with various technologies. The following is an example in HTML:
In an HTML based UI the following sample form could be used to create a data file set with code as "myfileSet" and upload two files with code "fileCode1" and "fileCode2" in one request:
<html> <form name="formtest" action="/filesets/multipart" method="POST" enctype="multipart/form-data"> <input type="text" name="dataFileSetCode" value="myfileSet" /> <input type="file" name="fileCode1" value="" /> <input type="file" name="fileCode2" value="" /> <input type="submit" value="Submit" /> </form> </html>
The system's response to this request will have the following structure:
<dataFileSet code='myfileSet'> <links> <link rel='self' type='application/xml' href='/datafilesets/myfileSet'/> </links> <dataFiles> <datafile code='fileCode1'> <links> <link rel='file' href='/datafilesets/myfileSet/datafiles/fileCode1/data'/> </links> </datafile> <datafile code='fileCode2'> <links> <link rel='file' href='/datafilesets/myfileSet/datafiles/fileCode2/data'/> </links> </datafile> </dataFiles> </dataFileSet>
In case of failure the response will be as specified in the standard structure under "Indicating Failure" in Response Messages.