1.0.1 • Published 6 years ago

ylh-open-api-nodejs-sdk v1.0.1

Weekly downloads
4
License
MIT
Repository
github
Last release
6 years ago

#use


const fs = require("fs");
const path = require("path");
const YunLianHuiRequest = require('ylh-open-api-nodejs-sdk');

//-----------------Iint yunlianhuiRequest----------------------
let yunlianhuiRequest =  new YunLianHuiRequest();
yunlianhuiRequest.gateWayUrl = 'https://openapidev.yunlianhui.com/';
yunlianhuiRequest.rsaPrivateKey=path.join(__dirname,'key','rsa_private_key.pem');
yunlianhuiRequest.yunlianhuirsaPublicKey=path.join(__dirname,'key','yunlianhui_public_key.pem');
yunlianhuiRequest.initParam();//every request must initParam

//------------------SET sendParam-------------------
yunlianhuiRequest.setParam('client_id','xxx');
yunlianhuiRequest.setParam('access_token','xxx');
yunlianhuiRequest.setParam('timestamp', yunlianhuiRequest.getNowUnixTimestamp());
//这个必须是最后一个参数 sign must be last param
yunlianhuiRequest.setParam('sign',yunlianhuiRequest.getSign());


//------------------Get result-------------------
yunlianhuiRequest.getRes('api/v2/getUserInfo')
.then((res)=>{
    let backRes = JSON.parse(res.body);
    console.log(backRes);
})
.catch((err)=>{
    console.log(err);
});
1.0.1

6 years ago

1.0.0

6 years ago