/mail/update_account


POST https://api.sitehost.nz/1.2/mail/update_account.json

Update the specified account on the specified server.

Form Parameters

ParameterTypeRequiredDescription
client_idintegerYesThe ID for the client that the server belongs to.Example: 1
server_namestringYesThe name of the server to update the account on.Example: my-mail-server
emailstringYesThe email address of the account to update.Example: bruce@example.com
params[label]stringAn updated label for the account.Example: Bruce Wayne
params[autoresponder]integerThe updated autoresponder status for the account.Example: 0
params[autoresponder_text]stringThe updated autoresponder text for the account. 0 to disable the autoresponder, 1 to enable.Example: I am out fighting crime.
params[spam_strategy]integerThe updated spam strategy for the account. 0 to disable, 1 to enable.Example: 0
params[password]stringThe updated password for the account.Example: imbatman
params[username]stringThe updated username for the account.Example: bruce@example.com
params[quota]integerThe updated quota for the account in MB.Example: 100

Code Samples

JavaScript PHP Rails Python
var xmlHttp = new XMLHttpRequest();
xmlHttp.open("POST", "https://api.sitehost.nz/1.2/mail/update_account.json", false);

var data = new FormData();
data.append("apikey", "your_key_here");
data.append("client_id", "1");
data.append("server_name", "my-mail-server");
data.append("email", "bruce@example.com");
data.append("params[label]", "Bruce Wayne");
data.append("params[autoresponder]", "0");
data.append("params[autoresponder_text]", "I am out fighting crime.");
data.append("params[spam_strategy]", "0");
data.append("params[password]", "imbatman");
data.append("params[username]", "bruce@example.com");
data.append("params[quota]", "100");

xmlHttp.send(data);

var response = xmlHttp.responseText;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.sitehost.nz/1.2/mail/update_account.json");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
$body = array(
'apikey' => 'your_key_here',
'client_id' => 1,
'server_name' => 'my-mail-server',
'email' => 'bruce@example.com',
'params[label]' => 'Bruce Wayne',
'params[autoresponder]' => 0,
'params[autoresponder_text]' => 'I am out fighting crime.',
'params[spam_strategy]' => 0,
'params[password]' => 'imbatman',
'params[username]' => 'bruce@example.com',
'params[quota]' => 100,
);
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);

$response = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
require 'net/http'
require 'uri'

uri = URI.parse("https://api.sitehost.nz/1.2/mail/update_account.json")
http = Net::HTTP.new(uri.host, uri.port)
request = Net::HTTP::Post.new(uri.request_uri)

body = {"apikey" => "your_key_here",
"client_id" => 1,
"server_name" => "my-mail-server",
"email" => "bruce@example.com",
"params[label]" => "Bruce Wayne",
"params[autoresponder]" => 0,
"params[autoresponder_text]" => "I am out fighting crime.",
"params[spam_strategy]" => 0,
"params[password]" => "imbatman",
"params[username]" => "bruce@example.com",
"params[quota]" => 100,
}
request.set_form_data(body)

response = http.request(request)
import requests
from collections import OrderedDict

uri = 'https://api.sitehost.nz/1.2/mail/update_account.json'

# We need ordered dictionary because parameters have to be in the right order.
# Refer to Developer Notes for more information.
body = OrderedDict()

body['apikey'] = 'your_key_here'
body['client_id'] = 1
body['server_name'] = 'my-mail-server'
body['email'] = 'bruce@example.com'
body['params[label]'] = 'Bruce Wayne'
body['params[autoresponder]'] = 0
body['params[autoresponder_text]'] = 'I am out fighting crime.'
body['params[spam_strategy]'] = 0
body['params[password]'] = 'imbatman'
body['params[username]'] = 'bruce@example.com'
body['params[quota]'] = 100

response = requests.post(uri, data=body)

Response

200:

application/json
{
  "return": {
    "job_id": "202944"
  },
  "msg": "Successful.",
  "status": true
}