SetHosts
Definition
Set host records for a domain name.
Usage
Use this command to change the host records for a domain name.
This command deletes the existing host records before replacing them with the host records included in the query string. To avoid unpleasant surprises for the user, some resellers use the GetHosts command to retrieve existing host records, and populate the SetHosts query string with existing host records while also allowing the user to add or delete host records.
To set SRV records, use the SetDomainSRVHosts command.
To enable or disable email, use the ServiceSelect command.
Availability
All resellers have access to this command.
Implementation on eNom.com
Log on to resellertest.enom.com with Login ID resellid, password resellpw.
https://resellertest.enom.com/domains/HostConfig.asp?DomainNameID=152533676
On the host settings page, the save changes button calls the SetHosts command.
Constraints
The query must meet the following requirements:
- The login ID and password must be valid.
- The domain name must belong to this account.
- This command deletes your existing host records before replacing them with the records you include in the query string. See Usage note, above.
Input parameters
Build the query string using this syntax:
https://resellertest.enom.com/interface.asp?
command=nameofcommand&uid=yourloginid&pw=yourpassword ¶mname=paramvalue&nextparamname=nextparamvalue
Parameter | Status | Description | Max Size |
---|---|---|---|
UID | Required | Account login ID | 20 |
PW | Required | Account password | 20 |
SLD | Required | Second-level domain name (for example, enom in enom.com) | 63 |
TLD | Required | Top-level domain name (extension) | 15 |
HostNameX X=1 to maximum 50 |
Required | Name of the host record to add. This command deletes all existing host records and replaces them with the records you supply in this query string. Index the parameters for each host record X; X must be numeric and in sequence beginning with 1. | 60 |
RecordTypeX X=1 to maximum 50 |
Required | Record type of host record X. Permitted values are: A IP address AAAA IPv6 address CNAME Alias record type, to associate a host name URL URL redirect FRAME Frame redirect MX Mail. Can be a host name under this domain name or the name of a mail MXE Mail Easy (email forwarding) TXT Text (SPF) record |
5 |
AddressX X=1 to maximum 50 |
Required | Address to redirect to. If RecordTypeX=A, AddressX must be an IP address If RecordTypeX=AAAA, AddressX must be an IPv6 address If RecordTypeX=CNAME, AddressX must be a fully qualified domain name (see Note) or a host name defined in this domain If RecordTypeX=URL, AddressX must be the exact URL of the page you redirect to, or an IP address, or a fully qualified domain name (see Note) If RecordTypeX=FRAME, AddressX is the actual URL, or the IP address, or the fully qualified domain name (see Note) of the page you want to display when someone types Your_Domain.com If RecordTypeX=MX, AddressX must be a fully qualified domain name (see Note) or a host name defined in this domain If RecordTypeX=MXE, AddressX must be an IP address If RecordTypeX=TXT, AddressX is a text (SPF) record. For help writing an SPF record, go to http://spf.pobox.com/wizard.html |
260 |
MXPrefX X=1 to maximum 50) |
Optional; use with record type MX; default is 10 | Host record preference for setting mail redirection. The lower the number, the higher the priority | 5 |
ResponseType | Optional | Format of response. Permitted values are Text (default), HTML, or XML. | 4 |
Returned parameters and values
Parameter | Description |
---|---|
Command | Name of command executed |
ErrCount | The number of errors if any occurred. If greater than 0, check the Err(1 to ErrCount) values. |
ErrX | Error messages explaining the failure. These can be presented as-is back to the client. |
Done | True indicates this entire response has reached you successfully. |
Notes
- A fully qualified domain name is expressed in the format “hostname.SLD.TLD.”. Note that the period at the end is an essential component of a fully qualified domain name.
- The default response format is plain text. To receive the response in HTML or XML format, send ResponseType=HTML or ResponseType=XML in your request.
- Check the return parameter ErrCount. If greater than 0, the transaction failed. The parameter Err(ErrCount) can be presented to the client. Otherwise, process the returned parameters as defined above.
- On executing this command, the MX records are not deleted. But all other hosts are deleted and re-created as required.
Example

The following query sets four host records for resellerdocs.com. The results:
- resellerdocs.com forwards mail to IP address 66.150.5.189.
- photos.resellerdocs.com points to domain name photos.msn.com
- yahoo.resellerdocs.com points to IP address 204.71.200.72
- msn.resellerdocs.com points to URL http://www.msn.com
Query
https://resellertest.enom.com/interface.asp?
command=sethosts&uid=resellid&pw=resellpw &sld=resellerdocs&tld=com&HostName1=@&RecordType1=A &Address1=66.150.5.189&HostName2=photos&RecordType2=CNAME &Address2=photos.msn.com.&HostName3=yahoo&RecordType3=URL &Address3=204.71.200.72&HostName4=msn&RecordType4=FRAME &Address4=http://www.msn.com&responsetype=xml
The error count value of 0 confirms that hosts have been set successfully:
Output
<?xml version="1.0" ?>
<interface-response>
<DomainRRP>E</DomainRRP>
<Command>SETHOSTS</Command>
<ErrCount>0</ErrCount>
<Server>Dev Workstation</Server>
<Site>enom</Site>
<IsLockable>True</IsLockable>
<IsRealTimeTLD>True</IsRealTimeTLD>
<Done>true</Done>
<debug>
<![CDATA[ ] ]>
</debug>
</interface-response>

The following query sets four host records for resellerdocs.com. The results:
- resellerdocs.com forwards mail to IP address 66.150.5.189.
- photos.resellerdocs.com points to domain name photos.msn.com
- yahoo.resellerdocs.com points to IP address 204.71.200.72
- msn.resellerdocs.com points to URL http://www.msn.com
Query
https://resellertest.enom.com/interface.asp?
command=sethosts&uid=resellid&pw=resellpw &sld=resellerdocs&tld=com&HostName1=@&RecordType1=A &Address1=66.150.5.189&HostName2=photos&RecordType2=CNAME &Address2=photos.msn.com.&HostName3=yahoo&RecordType3=URL &Address3=204.71.200.72&HostName4=msn&RecordType4=FRAME &Address4=http://www.msn.com&responsetype=html
The error count value of 0 confirms that hosts have been set successfully:
Output
;URL Interface
;Machine is SJL0VWRESELL_T
;Encoding Type is utf-8
Command: SETHOSTS
APIType: API.NET
Language: eng
ErrCount: 0
ResponseCount: 0
MinPeriod: 1
MaxPeriod: 10
Server: sjl0vwresell_t
Site: eNom
IsLockable: True
IsRealTimeTLD: True
TimeDifference: +8.00
ExecTime: 0.484
Done: true
TrackingKey: d5cd4178-d00c-40ad-bafc-60613a648669
RequestDateTime: 2/5/2015 3:04:05 PM

The following query sets four host records for resellerdocs.com. The results:
- resellerdocs.com forwards mail to IP address 66.150.5.189.
- photos.resellerdocs.com points to domain name photos.msn.com
- yahoo.resellerdocs.com points to IP address 204.71.200.72
- msn.resellerdocs.com points to URL http://www.msn.com
Query
https://resellertest.enom.com/interface.asp?
command=sethosts&uid=resellid&pw=resellpw &sld=resellerdocs&tld=com&HostName1=@&RecordType1=A &Address1=66.150.5.189&HostName2=photos&RecordType2=CNAME &Address2=photos.msn.com.&HostName3=yahoo&RecordType3=URL &Address3=204.71.200.72&HostName4=msn&RecordType4=FRAME &Address4=http://www.msn.com&responsetype=text
The error count value of 0 confirms that hosts have been set successfully:
Output
;URL Interface
;Machine is SJL0VWRESELL_T1
;Encoding Type is utf-8
Command=SETHOSTS
APIType=API.NET
Language=eng
ErrCount=0
ResponseCount=0
MinPeriod=1
MaxPeriod=10
Server=sjl0vwresell_t1
Site=eNom
IsLockable=True
IsRealTimeTLD=True
TimeDifference=+8.00
ExecTime=0.063
Done=true
TrackingKey=015451f3-9107-4964-8dd9-327cc52818c0
RequestDateTime=2/5/2015 3:04:28 PM