Child pages
  • WHM API 1 Functions - listmxs

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Description

Excerpt

This function lists a domain's MX records.

Multiexcerpt include
SpaceWithExcerptcom.atlassian.confluence.content.render.xhtml.model.resource.identifiers.SpaceResourceIdentifier@12665
MultiExcerptNameAPIDisabledDNSRole
PageWithExcerptLIB:_ServerRoleDisabledAPI

Panel
bgColor#F2F2F2
borderStylenone

Examples 


Panel
bgColor#FFFFFF
borderStylenone


Expand
titleJSON API


Code Block
languagexml
https://hostname.example.com:2087/cpsess##########/json-api/listmxs?api.version=1&domain=example.com



Expand
titleXML API


Code Block
languagexml
https://hostname.example.com:2087/cpsess##########/xml-api/listmxs?api.version=1&domain=example.com



Expand
titleCommand Line


Code Block
languagebash
whmapi1 listmxs domain=example.com

Include Page
LIB:_WHMAPI1CLINote
LIB:_WHMAPI1CLINote


Expand
titleOutput (JSON)


Code Block
languagetext
linenumberstrue
{
   "data":{
      "record":[
         {
            "Line":"21",
            "ttl":"14400",
            "class":"IN",
            "exchange":"mx1.example.com",
            "preference":"0",
            "type":"MX",
            "name":"example.com."
         },
         {
            "Line":"28",
            "ttl":"14400",
            "class":"IN",
            "exchange":"mx2.example.com",
            "preference":"20",
            "type":"MX",
            "name":"example.com.example.com."
         }
      ]
   },
   "metadata":{
      "result":1,
      "reason":"Records obtained.",
      "version":1,
      "command":"listmxs"
   }
}



Expand
titleOutput (XML)


Code Block
languagexml
linenumberstrue
<result>
    <data>
        <record>
            <Line>21</Line>
            <ttl>14400</ttl>
            <class>IN</class>
            <exchange>mx1.example.com</exchange>
            <preference>0</preference>
            <type>MX</type>
            <name>example.com.</name>
        </record>
        <record>
            <Line>28</Line>
            <ttl>14400</ttl>
            <class>IN</class>
            <exchange>mx2.example.com</exchange>
            <preference>20</preference>
            <type>MX</type>
            <name>example.com</name>
        </record>
    </data>
    <metadata>
        <result>1</result>
        <reason>Records obtained.</reason>
        <version>1</version>
        <command>listmxs</command>
    </metadata>
</result>


Include Page
LIB:_WHMAPIShellNote
LIB:_WHMAPIShellNote


Parameters

ParameterTypeDescriptionPossible valuesExample

domain

string

Required

The zone record's domain.

A valid domain name on the server.example.com

Returns

ReturnTypeDescriptionPossible valuesExample

record

array of hashesAn array of zone record data hashes.

This array of hashes includes the name, Line, class, ttl, type, exchange, and preference returns.

 

name

string

The record's name.

The function returns this value in the record array.

A valid domain name or hostname.

hostname.example.com

Line

integer

The zone record's line number.

The function returns this value in the record array.

A positive integer.1

class

string

The record's class.

The function returns this value in the record array.

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

IN

ttl

integer

The record's Time To Live (TTL).

The function returns this value in the record array.

A positive integer that represents the TTL, in seconds.

86400

type

string

The DNS record's type.

The function returns this value in the record array.

MX is the only possible value.

MX

exchange

string

The domain's mail exchanger.

The function returns this value in the record array.

A valid mail exchanger.mail.example.com

preference

integer

The MX record's priority order.

The function returns this value in the record array.

An integer that represents the record's priority order.

Note
titleNote:

Lower values indicate a higher priority order. 


20