# put\_server

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 AemGetServer in order to update the connection properties of an existing server.

First call AemGetServer, then edit the returned properties as required, and finally, call AemPutServer.

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

## Syntax

`def put_server(` `self,` `payload,` `server` `)`

## Parameters

Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| payload | AemServer | AemReplicateServer or AemComposeServer that is inherited from AemServer. |
| host | string | The host name or IP address of the server. |
| name | string | The name of the server. |
| description | string | The server description. |
| port | string | The port through which the server is accessed. |
| username | string | The user name to connect to the Replicate/Compose Server. |
| password | string | The password to connect to the Replicate/Compose Server.Note The password identifier (GUID) that is returned by GetServer is valid only for the session in which it was generated. Using it in another session (for example as input for PutServer) will result in exception. |
| verify\_server\_certificate | bool | 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 | bool | Whether to retrieve tasks and messages from this server or not. |
| server | string | The name of the server. |

## Return values

N/A

## Errors

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

Error responses

| Error | Message | Description |
| --- | --- | --- |
| DESERIALIZE\_TO\_TYPE | "Failed to deserialize json to type AemServer: {message}" | Returned when the JSON format is invalid format. For example, such an error will be returned if the JSON contains an unknown role. |
| 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. |
| AEM\_INVALID\_SERVER\_TYPE | Server type {ServerType} for server "{ServerName}" is not valid. | Returned when the an invalid server type is specified. |
| 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. |
| AEM\_EMPTY\_HOST | The host is missing from the request. | Returned when the host is missing from the request. |
| AEM\_EMPTY\_PORT | The port is missing from the request. | Returned when the port is missing from the request. |
| [](https://help.qlik.com/en-US/enterprise-manager/Content/EnterpriseManager/EnterpriseManager_APIGuide/PythonAPI/api_aem_putserver.htm)AEM\_EMPTY\_USERNAME | The username is missing from the request. | Returned when the user name is missing from the request. |
| AEM\_EMPTY\_PASSWORD | The password is missing from the request. | Returned when the password is missing from the request. |
| AEM\_INVALID\_PORT | The port is invalid. | Returned when the specified port is not valid. |
| [](https://help.qlik.com/en-US/enterprise-manager/Content/EnterpriseManager/EnterpriseManager_APIGuide/PythonAPI/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. |
| [](https://help.qlik.com/en-US/enterprise-manager/Content/EnterpriseManager/EnterpriseManager_APIGuide/PythonAPI/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. |
| [](https://help.qlik.com/en-US/enterprise-manager/Content/EnterpriseManager/EnterpriseManager_APIGuide/PythonAPI/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. |
| [](https://help.qlik.com/en-US/enterprise-manager/Content/EnterpriseManager/EnterpriseManager_APIGuide/PythonAPI/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. |
| 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. |