发送语音
请求
var https = require('https'); var querystring = require('querystring'); var postData = { mobile:'13712345678', code:'123456' }; var content = querystring.stringify(postData); var options = { host:'voice-api.luosimao.com', path:'/v1/verify.json', method:'POST', auth:'api:key-12312389d10fe16c98896ced5a09945188', agent:false, rejectUnauthorized : false, headers:{ 'Content-Type' : 'application/x-www-form-urlencoded', 'Content-Length' :content.length } }; var req = https.request(options,function(res){ res.setEncoding('utf8'); res.on('data', function (chunk) { console.log(JSON.parse(chunk)); }); res.on('end',function(){ console.log('over'); }); }); req.write(content); req.end();
返回结果
{"error":0,"msg":"ok"}
获取余额
请求
var https = require('https'); var options = { host:'voice-api.luosimao.com', path:'/v1/status.json', method:'GET', auth:'api:key-123123cd732d929feb06556c063010d1', agent:false, rejectUnauthorized : false }; var req = https.request(options,function(res){ res.setEncoding('utf8'); res.on('data', function (chunk) { console.log(chunk); }); }); req.on('error',function(e){ console.log(e.message); }); req.end();
返回结果
{"error":0,"deposit":"1119987446"}