Giter Site home page Giter Site logo

nodejs-client's Introduction

INWX Domrobot Node.js Client

You can access all functions of our frontend via our API, which is available via the JSON-RPC protocol and thus can be easily consumed with all programming languages.

There is also an OT&E test system, which you can access via ote.inwx.com. Here you will find the known web interface which is using a test database. On the OT&E system no actions will be charged. So you can test as much as you like there.

Documentation

You can view a detailed description of the API functions in our documentation. You can find the online documentation by clicking here.

If you still experience any kind of problems don't hesitate to contact our support via email.

Installation

The recommended way is via npm:

npm install --save domrobot-client

You can find more information about the package on npmjs.org.

Example

import { ApiClient, Language } from 'domrobot-client';

const username = '';
const password = '';
const sharedSecret = ''; // only needed for 2FA.
const domain = 'my-test-domain-' + Math.round(Math.random() * 1e8) + '.com'; // the domain which will be checked.

const asyncFunc = async () => {
    // By default your ApiClient uses the test api (OT&E). If you want to use the production/live api
    // we have a constant named API_URL_LIVE in the ApiClient class. Just set apiUrl=ApiClient.API_URL_LIVE and you're good.
    const apiClient = new ApiClient(ApiClient.API_URL_OTE, Language.EN, true);

    const loginResponse = await apiClient.login(username, password, sharedSecret);
    if (loginResponse.code !== 1000) {
        throw new Error(`Api login error. Code: ${loginResponse.code}  Message: ${loginResponse.msg}`);
    }

    // Make an api call and save the result in a variable.
    // We want to check if a domain is available, so we call the api method 'domain.check'.
    const domainCheckResponse = await apiClient.callApi('domain.check', { domain });
    if (domainCheckResponse.code !== 1000) {
        throw new Error(`Api error while checking domain status. Code: 
                            ${domainCheckResponse.code}  Message: ${domainCheckResponse.msg}`);
    }

    // get the first domain in the result array 'domain'
    const checkedDomain = domainCheckResponse.resData.domain[0];
    if (checkedDomain.avail === 1) {
        console.log(`${domain} is still available!`);
    } else if (checkedDomain.avail === -1) {
        console.log(`Availability of ${domain} could not be checked.`);
    } else {
        console.log(`Unfortunately, ${domain} is already registered.`);
    }
};

// call the async function
asyncFunc();

License

MIT

nodejs-client's People

Contributors

bernstein7z avatar ddmler avatar dependabot[bot] avatar mundry avatar nickufer avatar wmnnd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

nodejs-client's Issues

Problem logging in

Hello,

I have been using this client for a while but in recent month I started failing the log in:
Request (account.login): {"method":"account.login","params":{"user":"???","pass":"???"}} Response (account.login): {"code":2200,"msg":"Authentication error"}

This is the test code I am using:

const { ApiClient, Language } = require('domrobot-client');

const loginUsername = '???';
const loginPassword = '???';
const apiClient = new ApiClient(ApiClient.API_URL_OTE, Language.EN, true);

async function test() {
    const loginResponse = await apiClient.login(loginUsername, loginPassword);
    if (loginResponse.code !== 1000) {
        console.error('Api error: ' + loginResponse.code + ' message: ' + loginResponse.msg);
    } else {
        console.log('Successfully logged in !');
    }
}

test();

Versions:
Package: 3.0.2
OS: windows 10
Node: 14.18.0

I double checked that the same credentials can be used to log into the web-site.
Help would be appreciated.

Best regards,
Lutz

Security vulnerability because of deprecated request npm dependency

The npm depdency request has known security vulnerabilities and is deprecated for long time now.

> npm audit
request  *
Severity: moderate
Server-Side Request Forgery in Request - https://github.com/advisories/GHSA-p8p7-x288-28g6
No fix available
node_modules/request
  domrobot-client  *
  Depends on vulnerable versions of request
  Depends on vulnerable versions of request-promise-native
  node_modules/domrobot-client
  request-promise-core  *
  Depends on vulnerable versions of request
  node_modules/request-promise-core
    request-promise-native  >=1.0.0
    Depends on vulnerable versions of request
    Depends on vulnerable versions of request-promise-core
    node_modules/request-promise-native

4 moderate severity vulnerabilities

This dependency should be replaced by a modern http client. E.g. with the Node.js native and browser compatible fetch API or something else. request/request#3143


Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.