Listar sensores
curl --request GET \
--url https://api-bc.pgubright.com/sensors \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api-bc.pgubright.com/sensors', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api-bc.pgubright.com/sensors"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)[
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"device_id": "<string>",
"name": "<string>",
"public_key": "<string>",
"wallet_address": "0x70997970C51812dc3A010C7d01b50e0d17dc79C8",
"status": "active",
"location": "<string>",
"last_communication_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z"
}
]{
"message": "Usuário sem permissão para operar neste sensor.",
"code": "SENSOR_FORBIDDEN"
}Sensores
Listar sensores
Administradores veem todos. Demais usuários veem apenas sensores em que são sensor_admin.
GET
/
sensors
Listar sensores
curl --request GET \
--url https://api-bc.pgubright.com/sensors \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api-bc.pgubright.com/sensors', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api-bc.pgubright.com/sensors"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)[
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"device_id": "<string>",
"name": "<string>",
"public_key": "<string>",
"wallet_address": "0x70997970C51812dc3A010C7d01b50e0d17dc79C8",
"status": "active",
"location": "<string>",
"last_communication_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z"
}
]{
"message": "Usuário sem permissão para operar neste sensor.",
"code": "SENSOR_FORBIDDEN"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Response
Lista de sensores.
