本接口为采样器控制接口。
通过调用此接口可以对采样器进行采样控制,包括立即采样、预约采样和积分采样以及清除采样记录和清除状态标志
采样控制功能请谨慎使用
立即采样接口包括立即采样、清除采样记录和清除状态标志
-
post /api/equips/{equipId}/samplerAction HTTP/1.1
Host: dev.thuwater.com
X-TH-TOKEN: 26b0e5bfcbc.214ce96c1f7c9f0a33549b81087579b38b6a8.e9ba17523a25d766
Content-Type: application/x-www-form-urlencoded
action=sampling
-
var request = require("request");
var options = {
method: 'POST',
url: 'https://dev.thuwater.com/api/equips/samplerAction',
headers: {
'Host': 'dev.thuwater.com',
'X-TH-TOKEN': '26b0e5bfcbc.214ce96c1f7c9f0a33549b81087579b38b6a8.e9ba17523a25d766',
'Content-Type': 'application/x-www-form-urlencoded'
}
form: {
'action': 'sampling'
}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
-
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
RequestBody body = RequestBody.create(mediaType, "action=sampling");
Request request = new Request.Builder()
.url("https://dev.thuwater.com/api/equips/samplerAction")
.method("POST", body)
.addHeader("X-TH-TOKEN", "26b0e5bfcbc.214ce96c1f7c9f0a33549b81087579b38b6a8.e9ba17523a25d766")
.addHeader("Content-Type", "application/x-www-form-urlencoded")
.build();
Response response = client.newCall(request).execute();
action命令类型:
1、sampling 设置立即采样;
2、clearrecord 清除采样记录;
3、clear 清除状态标志。
参数名称 | 必填 | 说明 |
---|
X-TH-TOKEN | 是 | 通过登陆接口获取的token |
equipId | 是 | 设备ID 放入请求路径 |
action | 是 | 命令类型 sampling-设置立即采样; clearrecord-清除采样记录;clear-清除状态标志 |
参数名称 | 说明 |
---|
httpcode | 200-正常,401-无权限,500-其他错误。 |
result | 返回处理结果 |
msg | 返回信息 |
采样数据时间列表最多四组
-
Post /api/equips/{equipId}/addSamplerSchedule HTTP/1.1
Host: dev.thuwater.com
X-TH-TOKEN: eyJhbGciOiJIUzM4NCJ9
Content-Type: application/json
{
"integralInfoList": [
{
"startTime": "2022-01-11 00:00:00"
},
{
"startTime": "2022-01-12 00:00:00"
},
{
"startTime": "2022-01-13 00:00:00"
},
{
"startTime": "2022-01-14 00:00:00"
}
]
}
-
var request = require('request');
var options = {
'method': 'Post',
'url': 'https://dev.thuwater.com/api/equips/{equipId}/addSamplerSchedule',
'headers': {
'X-TH-TOKEN': 'eyJhbGciOiJIUzM4NCJ9',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"integralInfoList": [
{
"startTime": "2022-01-11 00:00:00"
},
{
"startTime": "2022-01-12 00:00:00"
},
{
"startTime": "2022-01-13 00:00:00"
},
{
"startTime": "2022-01-14 00:00:00"
}
]
})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
-
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{"integralInfoList": [{ "startTime": "2022-01-11 17:00:00"},{ "startTime": "2022-01-12 00:00:00"},{ "startTime": "2022-01-13 00:00:00"},{ "startTime": "2022-01-14 00:00:00"}]}");
Request request = new Request.Builder()
.url("https://dev.thuwater.com/api/equips/{equipId}/addSamplerSchedule")
.method("Post", body)
.addHeader("X-TH-TOKEN", "eyJhbGciOiJIUzM4NCJ9")
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
参数名称 | 类型 | 必填 | 说明 |
---|
X-TH-TOKEN | 字符串 | 是 | 通过登陆接口获取的token |
equipId | 整形 | 是 | 设备ID 放入请求路径 |
integralInfoList | integralInfo数组 | 是 | integralInfo任务详情list 最少1组最多4组 |
integralInfo | 类型 | 必填 | 说明 |
---|
startTime | 字符串 | 是 | 2022-01-11 00:00:00的格式时间 |
参数名称 | 说明 |
---|
httpcode | 200-正常,401-无权限,500-其他错误。 |
result | 返回处理结果 |
msg | 返回信息 |
采样数据时间列表最多四组,积分采样时间不可重叠
-
Post /api/equips/{equipId}/addSamplerIntegral HTTP/1.1
Host: dev.thuwater.com
X-TH-TOKEN: eyJhbGciOiJIUzM4NCJ9
Content-Type: application/json
{
"integralInfoList": [
{
"startTime": "2022-01-11 00:00:00",
"period": 60,
"perSum": 100,
"samplerCount": 5
},
{
"startTime": "2022-01-12 00:00:00",
"period": 60,
"perSum": 100,
"samplerCount": 5
},
{
"startTime": "2022-01-13 00:00:00",
"period": 60,
"perSum": 100,
"samplerCount": 5
},
{
"startTime": "2022-01-14 00:00:00",
"period": 60,
"perSum": 100,
"samplerCount": 5
}
]
}
-
var request = require('request');
var options = {
'method': 'Post',
'url': 'https://dev.thuwater.com/api/equips/{equipId}/addSamplerIntegral',
'headers': {
'X-TH-TOKEN': 'eyJhbGciOiJIUzM4NCJ9',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"integralInfoList": [
{
"startTime": "2022-01-11 00:00:00",
"period": 60,
"perSum": 100,
"samplerCount": 5
},
{
"startTime": "2022-01-12 00:00:00",
"period": 60,
"perSum": 100,
"samplerCount": 5
},
{
"startTime": "2022-01-13 00:00:00",
"period": 60,
"perSum": 100,
"samplerCount": 5
},
{
"startTime": "2022-01-14 00:00:00",
"period": 60,
"perSum": 100,
"samplerCount": 5
}
]
})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
-
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{"integralInfoList": [{ "startTime": "2022-01-11 00:00:00", "period": 60, "perSum": 100, "samplerCount": 5},{ "startTime": "2022-01-12 00:00:00", "period": 60, "perSum": 100, "samplerCount": 5},{ "startTime": "2022-01-13 00:00:00", "period": 60, "perSum": 100, "samplerCount": 5},{ "startTime": "2022-01-14 00:00:00", "period": 60, "perSum": 100, "samplerCount": 5}]}");
Request request = new Request.Builder()
.url("https://dev.thuwater.com/api/equips/{equipId}/addSamplerIntegral")
.method("Post", body)
.addHeader("X-TH-TOKEN", "eyJhbGciOiJIUzM4NCJ9")
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
参数名称 | 类型 | 必填 | 说明 |
---|
X-TH-TOKEN | 字符串 | 是 | 通过登陆接口获取的token |
equipId | 整形 | 是 | 设备ID 放入请求路径 |
integralInfoList | integralInfo数组 | 是 | integralInfo任务详情list 最少1组最多4组 |
integralInfo | 类型 | 必填 | 说明 |
---|
startTime | 字符串 | 是 | 2022-01-11 00:00:00的格式时间 |
period | 整形 | 是 | 间隔 60-255 采样间隔,必须大于等于60分钟 积分采样参数 |
perSum | 整形 | 是 | 每次采样量 0-255 积分采样参数 |
samplerCount | 整形 | 是 | 采样次数 每次采样数量(ml) * 采样次数,必须小于等于500 积分采样参数 |
参数名称 | 说明 |
---|
httpcode | 200-正常,401-无权限,500-其他错误。 |
result | 返回处理结果 |
msg | 返回信息 |