本文為您提供了Node.js語言版本的提交查詢接口對(duì)接DEMO示例
/**
* 安裝依賴:npm install querystring
* 測(cè)試執(zhí)行:node ./test.js
*/
var http = require('http')
var querystring = require('querystring');
function post(hostname, path, post_data, callback){
var options = {
hostname: hostname,
port: 80,
path: path,
method: 'POST',
headers: {
'Content-Type':'application/x-www-form-urlencoded',
}
}
var req = http.request(options, function(res){
var body ="";
res.setEncoding('utf8');
res.on('data', function(chunk){
//console.log(chunk.toString());
body += chunk;
});
res.on('end', function(){
var json = JSON.parse(body);
callback(json)
});
});
req.on('error', function(e){
console.log('msg:'+e.message);
});
req.write(post_data);
req.end();
}
var hostname = "api.ihuyi.com";
var request_uri = "/veh/vinveh/Submit.json";
//定義請(qǐng)求的數(shù)據(jù)
var values = {
"account":"xxxxxxxx", //APIID(用戶中心【認(rèn)證核驗(yàn)】-【車輛與道路運(yùn)輸信息驗(yàn)證】-【產(chǎn)品總覽】查看)
"password":"xxxxxxxxx", //1、APIKEY(用戶中心【認(rèn)證核驗(yàn)】-【車輛與道路運(yùn)輸信息驗(yàn)證】-【產(chǎn)品總覽】查看)
2、動(dòng)態(tài)密碼(生成動(dòng)態(tài)密碼方式請(qǐng)看該文檔末尾的說明)
"vin":"4567890", //車架號(hào)
"engine_number":"12345678", //VIN 碼對(duì)應(yīng)的發(fā)動(dòng)機(jī)號(hào)碼
"notice_model":"202012345", //公告號(hào)(廠商生產(chǎn)車輛時(shí)向工信部申請(qǐng)的號(hào)碼)
"time":"1623643787", //Unix時(shí)間戳(10位整型數(shù)字,當(dāng)使用動(dòng)態(tài)密碼方式時(shí)為必填)
}
var post_data = querystring.stringify(values);
//發(fā)起請(qǐng)求
post(hostname, request_uri, post_data, function(json){
//打印結(jié)果
console.log(json);
})
國內(nèi)專業(yè)互聯(lián)網(wǎng)團(tuán)隊(duì)
21年行業(yè)經(jīng)驗(yàn)
7x24小時(shí)售后支持
豐富的行業(yè)經(jīng)驗(yàn)
互 億 無 線 官 方 微 信 號(hào)
Copyright ? 2004-2025 上海思銳信息技術(shù)有限公司 All rights reserved. 滬ICP備07035915號(hào)-15 電信增值業(yè)務(wù)許可證:B2-20160082
服務(wù)熱線:
4008 808 898
服務(wù)熱線(工作時(shí)間):
4008 808 898
業(yè)務(wù)咨詢(非工作時(shí)間):
售后咨詢(非工作時(shí)間):
驗(yàn)證碼已發(fā)送到您的手機(jī),請(qǐng)查收!
輸入驗(yàn)證碼后,點(diǎn)擊“開通體驗(yàn)賬戶”按鈕可立即開通體驗(yàn)賬戶。