标签交互接口 (Tag Endpoints)
约 168 字小于 1 分钟
2026-05-19
使用方法 (Usage)
通过外部 HTTP 客户端调用,实现对系统内逻辑标签的读写。
参数签名 (Parameters)
- GET /tags/{name}:
name(path): 逻辑标签名称。
- POST /tags/{name}:
name(path): 逻辑标签名称。body(JSON): 待写入的值对象。
返回签名 (Returns)
- GET: 返回
Tag对象 JSON。 - POST: 返回
UniconResponse<bool>JSON。- 成功:200 OK。
- 失败:400 BadRequest。
使用案例 (Examples)
1. 使用 cURL 读取标签
curl -X GET "https://localhost:5001/tags/Temperature"2. 使用 HttpClient 写入标签 (C#)
var client = new HttpClient();
var response = await client.PostAsJsonAsync("https://localhost:5001/tags/SetPoint", 25.5);
if (response.IsSuccessStatusCode)
{
var result = await response.Content.ReadFromJsonAsync<UniconResponse<bool>>();
Console.WriteLine($"Write Success: {result.Data}");
}