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

Importing an existing configuration

The API supports the import of environments or applications. This works as follows:

  1. Upload the *.exp file to the target environment using a POST request, for example:

    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 conent></contentBase64>
    </fileDescription>

    This will return a list of file references for the given environment, 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, a file can be base64-encoded and put to the clipboard as follows: base64 -w 0 <filename>.exp | xclip -selection clipboard.

  2. Import the file to the given environment by sending a PUT request to the uploaded file with the import parameter set to true:

    Import file to environment
    Request method: PUT
    Request path: https://<hostname>:8037/nevisadmin/rest/configuration/environment/id-
    d8f4015b-31d9-412a-ae75-9a3d53d4874b/file/3497464845566785452070?partialUpdate=true&import=true
    Request params: `<none>`
    Query params: partialUpdate=true
    import=true
    Headers: Content-Type=application/xml
    Cookies: JSESSIONID=74a53d048457e076038542e466cf
    Body:
    <fileDescription name="env_test.exp"/>

    The type of import is determined by the file name:

    • env_xyz.exp will trigger an environment import
    • app_xyz.exp will trigger an application import
  3. Check on the environment variables of the target environment and make adjustments, if necessary. Variables with the export flag set will be set automatically on import. If an environment variable is empty but has a default value set, the value of the imported variable will be set to the default. In any other case, an empty variable will be created.

info

The list of (local) environment variables is available in the environment description. It can be obtained by sending a GET request to: https://<hostname>:8037/nevisadmin/rest/configuration/environment/<environmentId>/