Lock
Unlock
POST
/api/unlockOpen. Open to everyone who can reach Tempolight.
Answers a token valid for 12 hours: send it as the x-tempolight-token header (or ?token=). Each try takes 300 ms. Tokens are kept in memory, so a restart logs everyone out.
Request body application/json
pinstringrequiredResponses
200OKapplication/json
tokenstring403Locked, or not allowed.application/json
errorstringrequiredWhat went wrong, in a sentence for people.
Request
curl -X POST 'http://localhost:8080/api/unlock' \
-H 'content-type: application/json' \
-d '{
"pin": "1234"
}'const res = await fetch("http://localhost:8080/api/unlock", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({
"pin": "1234"
}),
});
const data = await res.json();
console.log(data);import requests
res = requests.post(
"http://localhost:8080/api/unlock",
json={
"pin": "1234"
},
)
print(res.json())Response
{
"token": "5f2d8a9c1e7b4f60"
}{
"error": "Wrong PIN"
}