Lock
Set a PIN
POST
/api/lockAdmin. Needs an unlock token (
x-tempolight-token) while a PIN lock is set; without a lock, anyone can call it.Locks settings with a PIN and answers a token so you stay unlocked. Every other token is logged out.
Request body application/json
pinstringrequired4 to 8 digits.
Pattern
^\d{4,8}$Responses
200OKapplication/json
lockedbooleantokenstring400The body isn't valid JSON, or a value is wrong.application/json
errorstringrequiredWhat went wrong, in a sentence for people.
403Locked, or not allowed.application/json
errorstringrequiredWhat went wrong, in a sentence for people.
Request
curl -X POST 'http://localhost:8080/api/lock' \
-H 'content-type: application/json' \
-d '{
"pin": "1234"
}'const res = await fetch("http://localhost:8080/api/lock", {
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/lock",
json={
"pin": "1234"
},
)
print(res.json())Response
{
"locked": true,
"token": "5f2d8a9c1e7b4f60"
}{
"error": "The PIN must be 4 to 8 digits"
}{
"error": "Settings are locked. Unlock with the PIN in Settings."
}