3.5.8.2 Python

Obtaining the server ID.

Since the API expects an object containing the server ID that you are either adding or removing from the server pool, you should obtain these details beforehand by querying for a list of Server IDs. See Section 3.5.3, “Listing Servers” for more information on this. Example code to extract a particular server ID based on its name within follows:

for i in client.service.serverGetIds():
    if i.name=='1.example.com':
       sid=i
Adding a server to a server pool.

Using the server ID that we obtained in Obtaining the server ID., we can add the server to the server pool that we created:

job=client.service.serverPoolAddServer(svrpool_id,sid)
wait_for_job(client,job.id)
Removing a server from a server pool.

Using the server ID that we obtained in Obtaining the server ID., we can remove the same server from the server pool that we created:

job=client.service.serverPoolRemoveServer(svrpool_id,sid)
wait_for_job(client,job.id)