Skip to content

Servers

Igor Balos edited this page Oct 1, 2018 · 6 revisions

For these API requests you will need to use a account API token. Once you obtain it, you will need to use account API client.

account_token = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
client = Postmark::AccountApiClient.new(account_token, secure: true)

Get server by ID

client.get_server(1)

# => { "ID": 1,"Name": "Staging Testing", "Color": "Red" ...}

Create server

server = new Server();
server.setName("NewServerName");

// create server
server = client.createServer(server);

Update server

server = new Server();
server.setName("CompletelyNewName");

// set server
server = client.setServer(serverId, server);

Get list of servers

Servers servers = client.getServers(Parameters.init().build("count", 5).build("offset", 0));
System.out.println(servers.getServers().get(0).getColor());

Delete a server

String response = client.deleteServer(serverId);