Skip to content

Address

Anton edited this page Aug 1, 2019 · 19 revisions

Methods to manipulate addresses. In contrast to the NameCheap API, it does not fall under the group users.

async getInfo(
  id: string|number,
): AddressDetail

Gets information for the requested address ID.

AddressDetail

Name Type & Description
EmailAddress* string
Email address of the user.
FirstName* string
First name of the user.
LastName* string
Last name of the user.
JobTitle string
Job designation of the user
Organization string
Organization of the user.
Address1* string
StreetAddress1 of the user.
Address2 string
StreetAddress2 of the user.
City* string
City of the user.
StateProvince* string
State/Province of the user.
StateProvinceChoice* string
State/Province choice of the user. Either 'S' or 'P'.
Zip* string
Zip/Postal code of the user.
Country* string
Two letter country code of the user.
Phone* string
Phone number in the format +NNN.NNNNNNNNNN.
PhoneExt string
PhoneExt of the user.
Fax string
Fax number in the format +NNN.NNNNNNNNNN.

The example shows how to get the details of the default address, which can then be used in a purchase of a domain name.

Source Output
const addresses =
  await nc.address.getList()
const { AddressId: id } =
  addresses
    .find(({ IsDefault }) =>
      IsDefault)
const res =
  await nc.address.getInfo(id)
{ AddressId: 101235,
  UserName: 'zavr',
  AddressName: 'Planet Express',
  Default_YN: true,
  FirstName: 'John',
  LastName: 'Zoidberg',
  JobTitle: 'Doctor',
  Organization: 'Planet Express',
  Address1: 'Planet Express',
  Address2: '57th Street',
  City: 'New New York',
  StateProvince: 'NY',
  StateProvinceChoice: 'S',
  Zip: '10019',
  Country: 'US',
  Phone: '+1.5417543010',
  PhoneExt: '',
  EmailAddress: 'zoidberg@futurama.bz' }

async getList(): !Array<!Address>

Gets a list of address IDs and address names associated with the user account.

Address

Name Type & Description
AddressId* number
A unique integer value that represents the address profile.
AddressName* number
The name of the address profile.
IsDefault* boolean
Whether it is a default address.

This method does not accept any arguments, and will always return the full list of addresses.

Source Output
await namecheap.address.getList()
[ { AddressId: 0,
    AddressName: 'Primary Address',
    IsDefault: false },
  { AddressId: 101235,
    AddressName: 'Planet Express',
    IsDefault: true } ]

Clone this wiki locally