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

Copying resources to another environment

In nevisAdmin 3, you can only assign resources, such as filters or realms, but not create or modify them. It is possible, however, to copy a resource from one (reference) environment to another.

Proceed as follows:

  1. Issue a POST request to an existing resource. The request must contain special instruction parameters. The following "inner" parameters are required:
    • copy (with the value set to "true").
    • destEnvironmentName (with the value set to the name of the destination environment). Note that the name is needed here, not the ID.
    • If the resource is duplicated within the same environment, also add the parameter newName (with the value set to the new name of the duplicated resource).
  2. If you use the Swagger UI, add the "inner" parameters in the Instructions input field, according to the following rules:
    • Parameters are separated by commas ,
    • Parameter name and value are separated by equal signs =

For example: destEnvironmentName=ExampleTargetEnvironmentName,copy=true,newName=DuplicatedFilter

Copy resource to another environment
Request method: POST
Request path: https://<hostname>:8037/nevisadmin/rest/configuration/environment/<environment
id>/resource/<resourceid>?
instructions=destEnvironmentName%3DExampleTargetEnvironmentName%2Ccopy%3Dtrue
Query params: instructions=destEnvironmentName%3DExampleTargetEnvironmentName%2Ccopy%3Dtrue
Cookies: JSESSIONID=4e1e41718c373a8cb65d754e0710
Body:
<filter>
<description/>
</filter>

The above sample code will return a reference to the new resource object, for example:

Reference to the resource copy
<references>
<reference type="filter" id="id-cfc29406-d436-4770-a441-3bfb202965e9"
name="ErrorFilter">
<link href="https://<hostname>:8037/nevisadmin/rest/configuration/environment/<id of
target environment>/resource/<id of the copied resource>"/>
</reference>
</references>

Provide the name of the cloned resource if you copy a resource within the same environment. Therefore, specify the newName property in the request:

Copy resource within the same environment
Request method:  POST
Request path: https://<hostname>:8037/nevisadmin/rest/configuration/environment/<environment
id>/resource/<resourceid>?instructions=destEnvironmentName%3DExampleTargetEnvironmentNam
e%2Ccopy%3Dtrue%2CnewName%3DDuplicatedFilter
Query params:
instructions=destEnvironmentName%3DExampleTargetEnvironmentName%2Ccopy%3Dtrue%2C
newName%3DDuplicatedFilter
Cookies: JSESSIONID=4e1e41718c373a8cb65d754e0710
Body:
<filter>
<description/>
</filter>
note

The copy operation may affect already existing objects in the target environment. If a resource already exists in the target environment, it will be merged with the copied resource.