Get a list of sensors
GET
/sensors
Header Parameters
- AuthorizationstringrequiredExample
{ "Authorization": "Bearer {jwt token}" }Description
Responses
200
- object[]
- _idstring
- hw_serialstringExample
- statusnumberExample
- user_idstring
- fw_versionstring
- sensor_profileobjectExample
{ "label": "My sensor", "street_and_number": "Flurstrasse 30", "zip_code": 8048, "city": "Zürich", "country": "sui" } - sensor_typestringExample
401
- object
- namestringExampleDescription
- messagestringExampleDescription
- codenumberExampleDescription
- classNamestringExampleDescription
- errorsobjectDescription
curl
curl --request GET \
--url /sensors \
--header 'accept: application/json' \
--header 'authorization: {"Authorization":"Bearer {jwt token}"}'javascript
var myHeaders = new Headers();
myHeaders.append("accept", "application/json");
myHeaders.append("content-type", "application/json");
myHeaders.append("authorization", "{\"Authorization\":\"Bearer {jwt token}\"}");
var requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};
fetch("/sensors", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));ruby
require "uri"
require "json"
require "net/http"
url = URI("/sensors")
http = Net::HTTP.new(url.host, url.port);
request = Net::HTTP::Get.new(url)
request["accept"] = "application/json"
request["content-type"] = "application/json"
request["authorization"] = "{\"Authorization\":\"Bearer {jwt token}\"}"
response = http.request(request)
puts response.read_body
python
import requests
import json
url = "/sensors"
payload = {}
headers = {
'accept': 'application/json',
'content-type': 'application/json',
'authorization': '{"Authorization":"Bearer {jwt token}"}'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
200
// OK
[
{
"_id": "",
"hw_serial": "SE01000000",
"status": 1,
"user_id": "",
"fw_version": "",
"sensor_profile": {},
"sensor_type": "clemap_lm"
}
]401
// Unauthorized
{
"name": "NotAuthenticated",
"message": "Not authenticated",
"code": 401,
"className": "not-authenticated",
"errors": {}
}Returns a list of all sensors that the authenticated user has access to.