Get a sensor by id
GET
/sensors/{sensor_id}
Path Parameters
- sensor_idstringrequiredDescription
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
403
- object
- namestringExampleDescription
- messagestringExampleDescription
- codenumberExampleDescription
- classNamestringExampleDescription
- errorsobjectDescription
curl
curl --request GET \
--url /sensors/{sensor_id} \
--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/{sensor_id}", 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/{sensor_id}")
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/{sensor_id}"
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": {}
}403
// Forbidden
{
"name": "Forbidden",
"message": "Access Forbidden",
"code": 403,
"className": "forbidden",
"errors": {}
}Returns a single sensor given that the user has access to it.