读取某变量的值(native

var http = require("http");

var options = {
"method": "GET",
"hostname": [
"127",
"0",
"0",
"1"
],
"port": "39321",
"path": [
"iotgateway",
"read"
],
"headers": {
"Connection": "keep-alive",
"Cache-Control": "max-age=0",
"Upgrade-Insecure-Requests": "1",
"User-Agent": "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.81 Safari/537.36",
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
"Accept-Encoding": "gzip, deflate, br",
"Accept-Language": "zh-CN,zh;q=0.9",
"cache-control": "no-cache",
}
}; var req = http.request(options, function (res) {
var chunks = []; res.on("data", function (chunk) {
chunks.push(chunk);
}); res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
}); req.end();

读取某变量的值(request

var request = require("request");

var options = { method: 'GET',
url: 'http://127.0.0.1:39321/iotgateway/read',
qs: { ids: [ 'Channel1.Device1.tag1', 'Channel1.Device1.tag2' ] },
headers:
{'cache-control': 'no-cache',
'Accept-Language': 'zh-CN,zh;q=0.9',
'Accept-Encoding': 'gzip, deflate, br',
Accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8',
'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.81 Safari/537.36',
'Upgrade-Insecure-Requests': '1',
'Cache-Control': 'max-age=0',
Connection: 'keep-alive' } }; request(options, function (error, response, body) {
if (error) throw new Error(error); console.log(body);
});

读取某变量的值(unirest

var unirest = require("unirest");

var req = unirest("GET", "http://127.0.0.1:39321/iotgateway/read");

req.query({
"ids": [
"Channel1.Device1.tag1",
"Channel1.Device1.tag2"
]
}); req.headers({"cache-control": "no-cache",
"Accept-Language": "zh-CN,zh;q=0.9",
"Accept-Encoding": "gzip, deflate, br",
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
"User-Agent": "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.81 Safari/537.36",
"Upgrade-Insecure-Requests": "1",
"Cache-Control": "max-age=0",
"Connection": "keep-alive"
}); req.end(function (res) {
if (res.error) throw new Error(res.error); console.log(res.body);
});

浏览全部变量(native

var http = require("http");

var options = {
"method": "GET",
"hostname": [
"127",
"0",
"0",
"1"
],
"port": "39321",
"path": [
"iotgateway",
"browse"
],
"headers": {
"Connection": "keep-alive",
"Cache-Control": "max-age=0",
"Upgrade-Insecure-Requests": "1",
"User-Agent": "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.81 Safari/537.36",
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
"Accept-Encoding": "gzip, deflate, br",
"Accept-Language": "zh-CN,zh;q=0.9",
"cache-control": "no-cache",
}
}; var req = http.request(options, function (res) {
var chunks = []; res.on("data", function (chunk) {
chunks.push(chunk);
}); res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
}); req.end();

浏览全部变量(request

var request = require("request");

var options = { method: 'GET',
url: 'http://127.0.0.1:39321/iotgateway/browse',
headers:
{ 'cache-control': 'no-cache',
'Accept-Language': 'zh-CN,zh;q=0.9',
'Accept-Encoding': 'gzip, deflate, br',
Accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8',
'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.81 Safari/537.36',
'Upgrade-Insecure-Requests': '1',
'Cache-Control': 'max-age=0',
Connection: 'keep-alive' } }; request(options, function (error, response, body) {
if (error) throw new Error(error); console.log(body);
});

浏览全部变量(unirest

var unirest = require("unirest");

var req = unirest("GET", "http://127.0.0.1:39321/iotgateway/browse");

req.headers({"cache-control": "no-cache",
"Accept-Language": "zh-CN,zh;q=0.9",
"Accept-Encoding": "gzip, deflate, br",
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
"User-Agent": "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.81 Safari/537.36",
"Upgrade-Insecure-Requests": "1",
"Cache-Control": "max-age=0",
"Connection": "keep-alive"
}); req.end(function (res) {
if (res.error) throw new Error(res.error); console.log(res.body);
});

最新文章

  1. python读取excel并制表输出
  2. MySQL zabbix
  3. SVN命令模式批量更新多个项目文件
  4. linux安装时出现your cpu does not support long mode的解决方法
  5. C语言运算符表
  6. 《算法导论》习题解答 Chapter 22.1-6(求universal sink 通用汇点)
  7. 利用ASP.NET MVC源代码调试你的应用程序[转]
  8. 常用的dos命令之简略总结
  9. 如何往IE工具条添加按钮(转载)
  10. ajax get/post
  11. iOS基础 - 定时器
  12. Nethogs - 网络流量监控工具
  13. java基础知识——网络编程、IO流
  14. 数据分析三剑客之pandas
  15. jmeter接口测试-GET请求路径中包含特殊字符或中文导致Response400报错
  16. git笔记(2)-常见命令的使用(详解待续)
  17. hdu 2815 Mod Tree (exBSGS)
  18. 由百度 “PHP薪资” 引发的思考
  19. 一文读懂遗传算法工作原理(附Python实现)
  20. (1.6)MySQL执行计划

热门文章

  1. table-layout 显示规则以及其他一些零碎的东西
  2. PHP开发——常见问题
  3. c#异步等待
  4. Informatica_(1)安装
  5. (转)Eclipse中需要查看某个类的源码,直接按住Ctrl 然后点击想要查看的类或则方法
  6. 2D情况下,复数的意义代表旋转
  7. java 字符串截取类 区分中文、英文、数字、标点符号
  8. bowtie:短序列比对的新工具
  9. Centos7 开启vsftpd
  10. h5解决移动端上滑卡顿问题