# PutServer

## General

### URL

https://[host]/attunityenterprisemanager/api/v1/servers/[server]/def

### Description

Adds a new Replicate/Compose Server or updates the server definition (Connection Properties) if the specified server already exists.

This method can be used together with ` GetServer  `in order to update the connection properties of an existing server. First call `GetServer`, then edit the returned properties as required, and finally, call `PutServer`.

### HTTP method

PUT

### Required user role

See [Required Enterprise Manager permissions](https://help.qlik.com/en-US/enterprise-manager/November2024/Content/EnterpriseManager/EnterpriseManager_APIGuide/Introduction/AEMPermissions.htm).

## Request parameters

Request parameters

| Location | Name | Required | Example |
| --- | --- | --- | --- |
| URL | Host [string] | Yes | computer.network.net |
| URL | ServerName [string] | Yes | myrepsrv1 |
| Header | EnterpriseManager.APISessionID [string] | Yes | wCo0\_KvjEUFROvfHF5KGrw |

## Request body

`{
`

`"$type": "{string}",
`

`"name": "{string}",
`

`"description": "{string}",
`

`"host": "{string}",
`

`"port": "{string}",
`

`"username": "{string}",
`

`"password": "{string}",`

`"verify_server_certificate": {bool},
`

`"monitored": {bool}
`

`}
`

## Request Parameters

Request parameters

| Name | Description |
| --- | --- |
| $type | The server's type: Can either be `AemReplicateServer` or `AemComposeServer`. |
| name | The name of the server.<br><br>For details of what constitutes a valid server name, see [AEM_INVALID_NAME](https://help.qlik.com/en-US/enterprise-manager/November2024/Content/EnterpriseManager/EnterpriseManager_APIGuide/CurlAPI/api_aem_putserver.htm#AEM_INVA). |
| description | The description of the server.<br><br>For details of what constitutes a valid description, see [AEM_INVALID_DESC](https://help.qlik.com/en-US/enterprise-manager/November2024/Content/EnterpriseManager/EnterpriseManager_APIGuide/CurlAPI/api_aem_putserver.htm#AEM_INVA2) |
| host | The host name or IP address of the server.<br><br>For details of what constitutes a valid host name, see [AEM_INVALID_HOST](https://help.qlik.com/en-US/enterprise-manager/November2024/Content/EnterpriseManager/EnterpriseManager_APIGuide/CurlAPI/api_aem_putserver.htm#AEM_INVA3) |
| port | The port through which the server is accessed. |
| username | The user name to connect to the server.<br><br>The specified user must be a server administrator.<br><br>For details of what constitutes a valid user name, see [AEM_INVALID_USERNAME](https://help.qlik.com/en-US/enterprise-manager/November2024/Content/EnterpriseManager/EnterpriseManager_APIGuide/CurlAPI/api_aem_putserver.htm#AEM_INVA4). |
| password | The password to connect to the server.<br><br>Information note<br><br>Within a session, the password identifier (GUID) that is returned by `GetServer` can be used in this request to indicate that the password should remain unchanged.<br><br>The password identifier returned by `GetServer` must be used in the same session, otherwise an error will occur. |
| verify\_server\_certificate | Set to true to ensure the Server certificate is trusted. As a rule, to reduce the chance of "man-in-the-middle" attacks, this option should always be set to true.<br><br><ul> <li>When connecting directly to an Qlik Replicate replication server (default port 3552) with its automatically generated self-signed certificate, Qlik Enterprise Manager is able to validate the certificate without requiring any additional setup. </li> </ul><br><br><ul> <li>When connecting to a Replicate Server via the Replicate UI Server (typically using port 443) or to the Replicate replication server with a user-installed certificate, you must make sure that the SSL/TLS certificate used by the server is trusted by the Qlik Enterprise Manager machine. The same applies when connecting to a Compose Server with a user-installed certificate. You can easily verify whether the certificate is trusted by opening a Chrome browser window on the Qlik Enterprise Manager machine and connecting to Replicate. If there are no security warnings, the certificate is trusted.</li> </ul><br><br>For information on the different ways of connecting to Qlik Replicate, see Qlik Replicate Server Requirements in the Qlik Enterprise Manager Help. |
| monitored | Whether to retrieve tasks and messages from this server or not. The default is true. |

## cURL example

### Request

`curl -i -k -X PUT --header "EnterpriseManager.APISessionID: wCo0_KvjEUFROvfHF5KGrw" --header "Content-Length: 242" https://computer.network.net/attunityenterprisemanager/api/v1/servers/myrepsrv1/def  -T "C:\myrepsrv1.json"`

### Request body

(content of "C:\myrepsrv1.json")

`{`

`"$type":"AemReplicateServer",` `"name":"myrepsrv1",` `"description":"replicate for business",` `"host":"rep2018r2gs7.qa.int",` `"port":"443",` `"username":"administrator",` `"password":"pass123",` `"verify_server_certificate":true,` `"monitored":true`

`}`

### Response

` Headers:
                 `

`HTTP/1.1 200 OK`

`Cache-Control: no-cache, no-store`

`Content-Length: 38`

`Content-Type: application/json; charset=utf-8`

`Server: Microsoft-HTTPAPI/2.0`

`Date: Mon, 26 Dec 2016 13:18:27 GMT`

## Error Response

All of the [general errors](https://help.qlik.com/en-US/enterprise-manager/November2024/Content/EnterpriseManager/EnterpriseManager_APIGuide/CurlAPI/error_handling.htm) as well as the errors listed in the table below.

Error responses

| HTTP Code | Enterprise Manager Code | Text | Description |
| --- | --- | --- | --- |
| 500 | DESERIALIZE\_TO\_TYPE | "Failed to deserialize json to type Server: {message}" | Returned when the JSON format is invalid format. For example, such an error will be returned if the JSON contains an unknown role. |
| 500 | AEM\_PUT\_SERVER\_INNER\_ERR | Failed to put server "{server}".<br><br>Error: "{message}". | Returned if Qlik Enterprise Manager encounters an error/exception when trying to PUT the server. |
| 500 | AEM\_INVALID\_SERVER\_TYPE | Server type {ServerType} for server "{ServerName}" is not valid. | Returned when an invalid server type is specified. |
| 500 | AEM\_NAME\_URL\_MISMATCH | The name of the server in the request does not match the one that is specified in the URL. | Returned when the name of the server in the request does not match the one that is specified in the URL. |
| 500 | AEM\_EMPTY\_HOST | The host is missing from the request. | Returned when the host is missing from the request. |
| 500 | AEM\_EMPTY\_PORT | The port is missing from the request. | Returned when the port is missing from the request. |
| 500 | [](https://help.qlik.com/en-US/enterprise-manager/Content/EnterpriseManager/EnterpriseManager_APIGuide/CurlAPI/api_aem_putserver.htm)AEM\_EMPTY\_USERNAME | The username is missing from the request. | Returned when the user name is missing from the request. |
| 500 | AEM\_EMPTY\_PASSWORD | The password is missing from the request. | Returned when the password is missing from the request. |
| 500 | AEM\_INVALID\_PORT | The port is invalid. | Returned when the specified port is not valid. |
| 500 | [](https://help.qlik.com/en-US/enterprise-manager/Content/EnterpriseManager/EnterpriseManager_APIGuide/CurlAPI/api_aem_putserver.htm)AEM\_INVALID\_USERNAME | The user name is invalid.<br><br>User names cannot exceed 104 characters and can contain all Unicode characters except for the following characters: Forward slash (/), Left square bracket ([), Right square bracket (]), Colon (:), Semicolon (;), Vertical bar (\|), Equal sign (=), Plus sign (+), Asterisk (\*), Question mark (?), Left angle bracket (&lt;), Right angle bracket (&gt;), Double quote (\"). | Returned when the specified user name is not valid. |
| 500 | [](https://help.qlik.com/en-US/enterprise-manager/Content/EnterpriseManager/EnterpriseManager_APIGuide/CurlAPI/api_aem_putserver.htm)AEM\_INVALID\_DESC | The description is invalid.<br><br>Descriptions cannot exceed 250 characters. | Returned when the description exceeds 250 characters. |
| 500 | [](https://help.qlik.com/en-US/enterprise-manager/Content/EnterpriseManager/EnterpriseManager_APIGuide/CurlAPI/api_aem_putserver.htm)AEM\_INVALID\_HOST | The host is invalid.<br><br>Hosts cannot exceed 64 characters and can only contain letters (a-z or A-Z), digits, spaces, dots (.), dashes (-), and underscores (\_). | Returned when the server host name exceeds 64 characters or contains invalid characters. |
| 500 | [](https://help.qlik.com/en-US/enterprise-manager/Content/EnterpriseManager/EnterpriseManager_APIGuide/CurlAPI/api_aem_putserver.htm)AEM\_INVALID\_NAME | The name of the server is invalid.<br><br>Server names cannot exceed 64 characters and can only contain letters (a-z or A-Z), digits, spaces, dots (.), dashes (-), and underscores (\_). | Returned when the server name exceeds 64 characters or contains invalid characters. |
| 500 | AEM\_HOST\_PORT\_ALREADY\_EXIST | Host {name/IP} and port {number} are already in use by another server. | Returned when both the server host name/IP address and the server port are already in use by another server. |
| 500 | - | - | - |