const https = require('https');

const data = JSON.stringify({ device: "your_device_name", token: "your_device_token", data: [["timestamp", "log1"]] });

const options = { hostname: 'iot.diandeng.tech', port: 443, path: '/api/v1/device/storage/logs', method: 'POST', headers: { 'Content-Type': 'application/json', 'Content-Length': data.length } };

const req = https.request(options, res => { console.log(statusCode: ${res.statusCode});

res.on('data', d => { process.stdout.write(d); }); });

req.on('error', error => { console.error(error); });

req.write(data); req.end()

使用NodeJS发送附带 device 设备名 token 设备token 设备上线返回值中的iotToken data timestamp log1参数POST请求httpsiotdiandengtechapiv1devicestoragelogs网站的NodeJS代码

原文地址: https://www.cveoy.top/t/topic/eMBU 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录