artemis-http-client

    1.0.3 • Public • Published

    artemis-http-client

    open8200 Artemis Http Client Nodejs SDK

    视频能力开放平台

    Installation

    $ npm install artemis-http-client

    Usage

    Example:

    const co = require('co');
    const {Client}  = require('artemis-http-client');
     
    //new Client(appKey, appSecret)
    const client = new Client('23967750', 'BZcz3VlqL1DVhWeF1boE');
     
    //GET
    co(function* () {
      var url = 'https://open8200.hikvision.com/artemis/api/artemis/v1/minus';
     
      var result = yield client.get(url, {
        query: {
          'a': 1,
          'b': 1
        },
        headers: {
          accept: 'application/json',
          'content-type':'text/plain;charset=UTF-8'
        }
      });
     
      console.log(JSON.stringify(result));
     
    }).catch((error)=>{
     
      //请求错误信息
      console.log(JSON.stringify(error.message));
     
    });
     
    //POST
    co(function* () {
      var url = 'https://open8200.hikvision.com/artemis/api/artemis/v1/plus';
     
      var result = yield client.post(url, {
        headers: {
          'content-type': "application/x-www-form-urlencoded;charset=UTF-8"
        },
        data: {
          'a': 1,
          'b': 1
        }
      });
     
      console.log(JSON.stringify(result));
     
    }).catch((error)=>{
     
      //请求错误信息
      console.log(JSON.stringify(error.message));
     
    });

    License

    (The MIT License)

    Install

    npm i artemis-http-client

    DownloadsWeekly Downloads

    1

    Version

    1.0.3

    License

    MIT

    Unpacked Size

    28.1 kB

    Total Files

    9

    Last publish

    Collaborators

    • open8200