File uploading serves two purposes:
- To support import functions.
- To support the upload of files to certain environments/entries (e.g., on the GUI).
For more information on the first use case, see chapter: Importing an existing configuration.
The following explains the second use case.
Files can be uploaded with a POST request and updated with a PUT request.
A file uploaded with a POST request will overwrite an existing file.
The code below illustrates this use case:
Request method: POST
Query params: `<none>`
<contentBase64><base64-encoded file content></contentBase64>
The previous sample will return a file reference of the uploaded file, for example:
<reference type="fileDescription" id="203526004114236574357542" name="env_test.exp">
On a Unix-based operating system, you can base64-encode a file and put it to the clipboard as follows:
base64 -w 0 <filename>.exp | xclip -selection clipboard.
It is also possible to mass-upload files. Zip the target files and upload the archive file. Make sure that the file name ends with
.zip, otherwise the system will store the file as any other file. But if you correctly use the
.zip format, the system will unpack the file and store its content. In this case, file references are not returned in response! To check the file list, use an appropriate GET request.