chirpstack api
直接调用chirpstack api接口实现对Lorasever的管理
注意:访问api接口需携带token信息

右上角添加token
#实现对网关的增删改查
接口:查get api/gateways
返回数据
{
"totalCount": "3",
"result": []
}#注意这里只返回数据条数
要想显示数据走下面这条路由:api/gateways?limit=2 gateways后面不能有/对于查询所有和添加
格式:
{
"id": "02429afffe523b87",#网关id很重要删除更新都需要这个id
"name": "02429afffe523b87",#网关名称
"description": "02429afffe523b87",
"createdAt": "2022-05-06T08:48:40.489595Z",
"updatedAt": "2023-04-03T15:02:07.655210Z",
"firstSeenAt": "2022-05-06T08:49:03.730524Z",
"lastSeenAt": "2023-04-03T15:02:07.654207Z",
"organizationID": "1",###这个和token一起存在了网页上
"networkServerID": "1",
"location": {
"latitude": 0,
"longitude": 0,
"altitude": 0,
"source": "UNKNOWN",
"accuracy": 0
},
"networkServerName": "local_ns"
},
#添加网关 post api/gateways
模板案列
{
"gateway": {
"boards": [
{
"fineTimestampKey": "string",
"fpgaID": "string"
}
],
"description": "string",
"discoveryEnabled": true,
"gatewayProfileID": "string",
"id": "string",
"location": {
"accuracy": 0,
"altitude": 0,
"latitude": 0,
"longitude": 0,
"source": "UNKNOWN"
},
"metadata": {},
"name": "string",
"networkServerID": "string",
"organizationID": "string",
"serviceProfileID": "string",
"tags": {}
}
}
##上边这个我没弄懂从网上找了一个能看懂的
{
"gateway":{
"location":{},
"name":"gw123",
"description":"222",
"id":"0001e1abb6975616",#网关ID
"gatewayProfileID":null,这个要设置无
"networkServerID":"1",#网络服务
"organizationID":"1"
}
}
或者
{
"gateway":{
"location":{},
"name":"g6123",
"description":"222",
"id":"3001e16bb6975616",
"serviceProfileID": "128a20f5-f526-472b-8cb4-1bb428de4cb3",
"gatewayProfileID":"a4ce0454-68b2-48ca-a8c8-c5d7ab6669ed",# 固定
"networkServerID":"1",#固定
"organizationID":"1"#变
}
}
只需要在路由中携带网关id就可以删除 例如:
api/gateways/0001e1abb6975616 网关id
#更新
api/gateways/0001e1abb6975616
{
"gateway":{
"location":{},
"name":"gw123",
"description":"222",
"id":"0001e1abb6975616",#网关id
"gatewayProfileID":null,这个要设置无
"networkServerID":"1",#网络服务
"organizationID":"1"
}
}
以这种形式发送 网关id无法修改
##查询单个数据
api/gateways/0001e1abb6975616
返回数据格式
{
"gateway": {
"id": "0001e1abb6975616",
"name": "ttw123",
"description": "2",
"location": {
"latitude": 0,
"longitude": 0,
"altitude": 0,
"source": "UNKNOWN",
"accuracy": 0
},
"organizationID": "1",
"discoveryEnabled": false,
"networkServerID": "1",
"gatewayProfileID": "",
"boards": [],
"tags": {},
"metadata": {},
"serviceProfileID": ""
},
"createdAt": "2023-04-04T14:18:26.871616Z",
"updatedAt": "2023-04-04T14:21:54.749243Z",
"firstSeenAt": null,
"lastSeenAt": null
}

浙公网安备 33010602011771号