npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@technobros/domainr-api

v1.2.2

Published

Unofficial Domainr API client for NodeJS

Downloads

1

Readme

domainr-api

npm version npm downloads Build Status License: MIT

This is simple and lightweight NodeJS wrapper for Domainr API V2. All methods are returning Promises!

  1. Requirements
  2. Instalation
  3. Usage
    1. Initialization
    2. Search method
    3. Status method
    4. Register method
  4. Official documentation
  5. Author
  6. Future

Requirements

For using this library, you will need Mashape Key (How to get free mashape key?). You will can use 10000 request for free each month!

Package requires NodeJS version >= 4.0.0

Installation

To install domainr-api, run:

npm install domainr-api --save

Usage

Domainr-api class comes with three main methods. Methods always return a promise.

Methods are:

Initialization

To initialize domainr-api class, you need to pass your Mashape key.

let domainrApi = new domainr('some-key');

Search method

Search method let's you search for domain. You will get results array with some domain recommendations.

It accepts these arguments:

| Parameter | Required | Type | Description | Example | | --------- | -------- | ---- | ----------- | ------- | | query | Yes | String | Term(s) to search against. | acme cafe | | location | No | String | Optionally override the IP location detection for country-code zones, with a two-character country code. | de | | registrar | No | String | The domain name of a specific registrar to filter results by that registrar’s supported list of extensions (optional). | namecheap.com | | defaults | No | String | Optional comma-separated list of default zones to include in the response. | bike,cab |

Example request:

let searchObj = {
    defaults: 'club,coffee',
    location: 'de',
    query: 'acme cafe',
    registrar: 'namecheap.com'
};

let domainrApi = new domainr('some-key');
domainrApi
  .search(searchObj)
  .then(data => console.log(data))
  .catch(err => console.log(err));

Data returned

[
    {
        "domain": "acme.coffee",
        "host": "",
        "subdomain": "acme.",
        "zone": "coffee",
        "path": "",
        "registerURL": "https://api.domainr.com/v2/register?&domain=acme.coffee&registrar=namecheap.com&source=api"
    },
    {
        "domain": "acme.kitchen",
        "host": "",
        "subdomain": "acme.",
        "zone": "kitchen",
        "path": "",
        "registerURL": "https://api.domainr.com/v2/register?&domain=acme.kitchen&registrar=namecheap.com&source=api"
    },
    {
        "domain": "acme.restaurant",
        "host": "",
        "subdomain": "acme.",
        "zone": "restaurant",
        "path": "",
        "registerURL": "https://api.domainr.com/v2/register?&domain=acme.restaurant&registrar=namecheap.com&source=api"
    },
    {
        "domain": "acmecafe.de",
        "host": "",
        "subdomain": "acmecafe.",
        "zone": "de",
        "path": "",
        "registerURL": "https://api.domainr.com/v2/register?&domain=acmecafe.de&registrar=namecheap.com&source=api"
    },
    {
        "domain": "acmecafe.com",
        "host": "",
        "subdomain": "acmecafe.",
        "zone": "com",
        "path": "",
        "registerURL": "https://api.domainr.com/v2/register?&domain=acmecafe.com&registrar=namecheap.com&source=api"
    },
    {
        "domain": "acmecafe.net",
        "host": "",
        "subdomain": "acmecafe.",
        "zone": "net",
        "path": "",
        "registerURL": "https://api.domainr.com/v2/register?&domain=acmecafe.net&registrar=namecheap.com&source=api"
    },
    {
        "domain": "acmecafe.org",
        "host": "",
        "subdomain": "acmecafe.",
        "zone": "org",
        "path": "",
        "registerURL": "https://api.domainr.com/v2/register?&domain=acmecafe.org&registrar=namecheap.com&source=api"
    }
]

Status method

Status method gives you status for each domain you send in array. You will get status array with domain information. It has limit to 10 domains per call.

It accepts these arguments:

| Parameter | Required | Type | Description | Example | | --------- | -------- | ---- | ----------- | ------- | | domains | Yes | Array of strings | Array of domains to check | ['acme.coffee', 'acmecafe.com'] |

Example request:

let domains = ['ace.coffee', 'acecafe.com', 'acecafe.net', 'acecafe.co', 'acecafe.io'];

let domainrApi = new domainr('some-key');
domainrApi
  .status(domains)
  .then(data => console.log(data))
  .catch(err => console.log(err));

Data returned

[
    {
        "domain": "acecafe.net",
        "zone": "net",
        "status": "active",
        "summary": "active"
    },
    {
        "domain": "acecafe.com",
        "zone": "com",
        "status": "active",
        "summary": "active"
    },
    {
        "domain": "acecafe.co",
        "zone": "co",
        "status": "active",
        "summary": "active"
    },
    {
        "domain": "ace.coffee",
        "zone": "coffee",
        "status": "undelegated active",
        "summary": "active"
    },
    {
        "domain": "acecafe.io",
        "zone": "io",
        "status": "undelegated inactive",
        "summary": "inactive"
    }
]

Register method

Register method gives generated URL that redirects user to checkout page. It's sent as a string.

It accepts these arguments:

| Parameter | Required | Type | Description | Example | | --------- | -------- | ---- | ----------- | ------- | | domain | Yes | String | Domain name. | example.com | | registrar | No | String | Registrar domain name | namecheap.com |

Example request:

let domainrApi = new domainr('some-key');
domainrApi
  .register('example.com')
  .then(data => console.log(data))
  .catch(err => console.log(err));

Data returned

https://www.shareasale.com/r.cfm?b=210737&m=25581&u=303669&urllink=https%3A%2F%2Fiwantmyname.com%2Fsearch%2Fadd%2Fexample.com%3Fr%3Ddomai.nr

Official documentation

Official Domainr documentation can be found on: http://domainr.build/docs

Author

Author of the package is Ivan Jovanovic.

Future

I have couple things in mind for the future:

  • [x] ~~Add Register method to the class~~
  • [ ] Create a ChatBot that will easily search/check/register domains

Started working on chatbot on https://github.com/IvanJov/domain-bot