Skip to main content
Version: 3.8.x.x LTS

File Upload

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.

tip

A file uploaded with a POST request will overwrite an existing file.

The code below illustrates this use case:

File upload to environment
Request method:  POST
Request path:
https://<hostname>:8037/nevisadmin/rest/configuration/environment/<envid>/file
Query params: `<none>`
Multiparts: `<none>`
Headers: Content-Type=application/xml
Cookies: JSESSIONID=736e571ffeca0020b72f0d686099
Body:
<fileDescription name="env_test.exp">
<directory>/</directory>
<contentBase64><base64-encoded file content></contentBase64>
</fileDescription>

The previous sample will return a file reference of the uploaded file, for example:

List of file references
<references>
<reference type="fileDescription" id="203526004114236574357542" name="env_test.exp">
<link href="https://<hostname>:8037/nevisadmin/rest/configuration/environment/id-
c4aa69dc-d0fd-4d32-bd2b-00aada1c0b37/file/203526004114236574357542"/>
</reference>
</references>

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.