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

hikopenapi-node

v1.1.0

Published

hikvision openapi for ifar/isee artemis rest service

Downloads

230

Readme

HIKOPENAPI-NODE

iSee/iFar Artemis Http Client Nodejs SDK

接口获取:海康威视开放平台

GITHUB:https://github.com/qoddi/hikopenapi-node.git

适配ISC/PVIA等基于iSee/iFar架构的平台,基于OpenAPI 安全认证库封装了 HTTP/HTTPS 的 POST/GET 方法,提供nodejs下调 OpenAPI HTTP 接口统一的入口。OpenAPI 安全认证库屏蔽了 OpenAPI HTTP 接口签名细节以及重定向处理过程,降低对接OpenAPI 的复杂度,使用方只需引入即可方便快速的实现 HTTP 通信。

Support

适配windows x64环境与linux x64环境,已经测试通过的环境包括

  1. 【windows 10 + nodejs v10.16.0】
  2. 【windows server 2016 + nodejs v10.16.0】
  3. 【CentOS-7.4-hik-r4 + nodejs v10.16.0】

平台需部署openapi网关后即可调用相关接口,appKey appSecret请联系海康工作人员获取,请求请使用https://portal_ip:443/artemis/

Author

qoddi

email:[email protected]

Installation

$ npm install hikopenapi-node

Usage

Windows

windows下安装部署即可直接使用,无需特殊配置,基于cpp认证库,提供post get put delete四种方法支持,返回data需要使用Base64解密 Example:

const Hikopenapi=require('hikopenapi-node');

let requestUrl='https://123.123.123.123:443/artemis/api/video/v1/cameras/previewURLs';
let headers={"content-type":"application/json","accept":"application/json"};
let body=JSON.stringify({
    "cameraIndexCode":  "fsjdfkj2hkjsdhfkajhskdjahksdjahksjfhsf" ,
    "streamType":0,
    "protocol":"rtsp",
    "transmode":0,
    "expand":"transcode=0"});
let timeout=15;
let appKey='12345';
let appSecret='skjfhakjshdakjh12312jkhk';
//封装认证库POST方法
let httpRes=await Hikopenapi.httpPost(requestUrl,headers,body,appKey,appSecret,timeout);
console.log(httpRes);  //{"status":true,error:0,data:""}

//封装认证库GET方法
let httpRes=await Hikopenapi.httpGet(requestUrl,headers,appKey,appSecret,timeout);
console.log(httpRes); //{"status":true,error:0,data:""}

//封装认证库DELETE方法
let httpRes=await Hikopenapi.httpDelete(requestUrl,headers,appKey,appSecret,timeout);
console.log(httpRes); //{"status":true,error:0,data:""}

//封装认证库PUT方法
let httpRes=await Hikopenapi.httpPut(requestUrl,headers,body,appKey,appSecret,timeout);
console.log(httpRes); //{"status":true,error:0,data:""}

Linux

linux下需要配置动态库的环境变量,基于c认证库,提供post get两种方法支持,返回data需要使用Base64解密,配置方法如下

  1. 查找本模块的安装位置,拷贝目录下lib/linux/x64下全部文件到/root/openapilib文件夹(自行创建)
  2. 编辑/etc/ld.so.conf,在最下面新增一行/root/openapiilib并保存退出
  3. 执行ldconfig指令,使配置文件生效,然后就和windows一样使用了

Example:

const Hikopenapi=require('hikopenapi-node');

let requestUrl='https://123.123.123.123:443/artemis/api/video/v1/cameras/previewURLs';
let headers={"content-type":"application/json","accept":"application/json"};
let body=JSON.stringify({
    "cameraIndexCode":  "fsjdfkj2hkjsdhfkajhskdjahksdjahksjfhsf" ,
    "streamType":0,
    "protocol":"rtsp",
    "transmode":0,
    "expand":"transcode=0"});
let timeout=15;
let appKey='12345';
let appSecret='skjfhakjshdakjh12312jkhk';
//封装认证库POST方法
let httpRes=await Hikopenapi.httpPost(requestUrl,headers,body,appKey,appSecret,timeout);
console.log(httpRes); //{"status":true,error:0,data:""}

//封装认证库GET方法
let httpRes=await Hikopenapi.httpGet(requestUrl,headers,appKey,appSecret,timeout);
console.log(httpRes); //{"status":true,error:0,data:""}

Error Code

| 码值 | 信息 | | :--------: | :---------------:| | 0 | 无错误 | | 10000以下 | http状态 | | 10001 | 参数错误 | | 10002 | 分配session失败 | | 10003 | 设置头域失败 | | 10004 | 发起网络请求失败 | | 10005 | 分配内存失败 | | 10006 | 获取重定向Url失败 | | 20000 | 其他错误 | | 30000 | 加载动态库失败 | | 30001 | 加载函数指针失败 |

License

(The MIT License)