Child pages
  • WHM API 1 Functions - savemxs
Skip to end of metadata
Go to start of metadata

Description

This function creates a new MX record.

Important:

In cPanel & WHM version 76 and later, when you disable the DNS role, the system disables this function. For more information, read our How to Use Server Profiles documentation.

Examples 


 JSON API
https://hostname.example.com:2087/cpsess##########/json-api/savemxs?api.version=1&domain=example.com&name=mail&exchange=ns1.example.com&preference=10&ttl=14400
 XML API
https://hostname.example.com:2087/cpsess##########/xml-api/savemxs?api.version=1&domain=example.com&name=mail&exchange=ns1.example.com&preference=10&ttl=14400
 Command Line
whmapi1 savemxs domain=example.com name=mail exchange=ns1.example.com preference=10 ttl=14400


Notes:

  • You must URI-encode values.
  • For more information and additional output options, read our Guide to WHM API 1 documentation or run the whmapi1 --help command.
  • If you run CloudLinux™, you must use the full path of the whmapi1 command:

    /usr/local/cpanel/bin/whmapi1

 Output (JSON)
{
  "metadata": {
    "result": 1,
    "reason": "Bind reloading on server1 using rndc zone: [example.com]\n",
    "version": 1,
    "command": "savemxs"
  }
}
 Output (XML)
<result>
    <metadata>
        <result>1</result>
        <reason>Bind reloading on server1 using rndc zone: [example.com]</reason>
        <version>1</version>
        <command>savemxs</command>
    </metadata>
</result>


Note:

Use WHM's API Shell interface (WHM >> Home >> Development >> API Shell) to directly test WHM API calls.

Parameters

ParameterTypeDescriptionPossible valuesExample

domain

string

Required

The zone record's domain.

A valid domain name on the server.example.com

name

string

Required

The record name.

A valid domain name or hostname.

mail.example.com

exchange

string

Required

The domain's mail exchanger.

A valid mail exchanger.mail.example.com

preference

integer

Required

The MX record's priority order.

An integer that represents the record's priority order.

Note:

Lower numbers indicate a higher priority order. 

20

class

string

The record's class.

This value defaults to IN.

  • IN
  • Very rarely, another valid DNS record class.

IN
ttlintegerThe record's Time To Live (TTL).

A positive integer that represents the TTL, in seconds.

86400
serialnumintegerThe record's serial number.A valid serial number. 2013122501

Returns

This function only returns metadata.