# salt.modules.namecheap_domains

Namecheap Domain Management

Added in version 2017.7.0.

## Prerequisites

This module uses the `requests` Python module to communicate to the namecheap API.

## Configuration

The Namecheap username, API key and URL should be set in the minion configuration file, or in the Pillar data.

    namecheap.name: companyname
    namecheap.key: a1b2c3d4e5f67a8b9c0d1e2f3
    namecheap.client_ip: 162.155.30.172
    #Real url
    namecheap.url: https://api.namecheap.com/xml.response
    #Sandbox url
    #namecheap.url: https://api.sandbox.namecheap.xml.response

salt.modules.namecheap_domains.check(*domains_to_check)

  Checks the availability of domains

  domains_to_check

    array of strings List of domains to check

  Returns a dictionary mapping the each domain name to a boolean denoting whether or not it is available.

  CLI Example:

      salt 'my-minion' namecheap_domains.check domain-to-check

salt.modules.namecheap_domains.create(domain_name, years, **kwargs)

  Try to register the specified domain name

  domain_name

    The domain name to be registered

  years

    Number of years to register

  Returns the following information:

  - Whether or not the domain was renewed successfully

  - Whether or not WhoisGuard is enabled

  - Whether or not registration is instant

  - The amount charged for registration

  - The domain ID

  - The order ID

  - The transaction ID

  CLI Example:

      salt 'my-minion' namecheap_domains.create my-domain-name 2

salt.modules.namecheap_domains.get_info(domain_name)

  Returns information about the requested domain

  returns a dictionary of information about the domain_name

  domain_name

    string Domain name to get information about

  CLI Example:

      salt 'my-minion' namecheap_domains.get_info my-domain-name

salt.modules.namecheap_domains.get_list(list_type=None, search_term=None, page=None, page_size=None, sort_by=None)

  Returns a list of domains for the particular user as a list of objects offset by `page` length of `page_size`

  list_typeALL

    One of `ALL`, `EXPIRING`, `EXPIRED`

  search_term

    Keyword to look for on the domain list

  page1

    Number of result page to return

  page_size20

    Number of domains to be listed per page (minimum: `10`, maximum: `100`)

  sort_by

    One of `NAME`, `NAME_DESC`, `EXPIREDATE`, `EXPIREDATE_DESC`, `CREATEDATE`, or `CREATEDATE_DESC`

  CLI Example:

      salt 'my-minion' namecheap_domains.get_list

salt.modules.namecheap_domains.get_tld_list()

  Returns a list of TLDs as objects

  CLI Example:

      salt 'my-minion' namecheap_domains.get_tld_list

salt.modules.namecheap_domains.reactivate(domain_name)

  Try to reactivate the expired domain name

  Returns the following information:

  - Whether or not the domain was reactivated successfully

  - The amount charged for reactivation

  - The order ID

  - The transaction ID

  CLI Example:

      salt 'my-minion' namecheap_domains.reactivate my-domain-name

salt.modules.namecheap_domains.renew(domain_name, years, promotion_code=None)

  Try to renew the specified expiring domain name for a specified number of years

  domain_name

    The domain name to be renewed

  years

    Number of years to renew

  Returns the following information:

  - Whether or not the domain was renewed successfully

  - The domain ID

  - The order ID

  - The transaction ID

  - The amount charged for renewal

  CLI Example:

      salt 'my-minion' namecheap_domains.renew my-domain-name 5