Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

domainr-api

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

domainr-api

Unofficial Domainr API client for NodeJS

  • 1.2.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
increased by200%
Maintainers
1
Weekly downloads
 
Created
Source

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:

ParameterRequiredTypeDescriptionExample
queryYesStringTerm(s) to search against.acme cafe
locationNoStringOptionally override the IP location detection for country-code zones, with a two-character country code.de
registrarNoStringThe domain name of a specific registrar to filter results by that registrar’s supported list of extensions (optional).namecheap.com
defaultsNoStringOptional 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:

ParameterRequiredTypeDescriptionExample
domainsYesArray of stringsArray 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:

ParameterRequiredTypeDescriptionExample
domainYesStringDomain name.example.com
registrarNoStringRegistrar domain namenamecheap.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:

  • 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

Keywords

FAQs

Package last updated on 03 Jan 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc