Hearing
Choose how to hear music
POST
/api/hearing/useAdmin. Needs an unlock token (
x-tempolight-token) while a PIN lock is set; without a lock, anyone can call it.Turns that way on: this computer's sound, a browser's microphone, or a sound input on a Pi (and server capture on or off).
Request body application/json
choicestringrequiredOne of
"computer" "mic" "pi" ""Responses
200OKapplication/json
platformstringmethodstringproblemany | nullrecommendedstringOne of
"computer" "mic" "pi"computerobjectpiobjectcaptureobjectServer capture.
outputanyThe sound output playing now.
400The 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/hearing/use' \
-H 'content-type: application/json' \
-d '{
"choice": "computer"
}'const res = await fetch("http://localhost:8080/api/hearing/use", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({
"choice": "computer"
}),
});
const data = await res.json();
console.log(data);import requests
res = requests.post(
"http://localhost:8080/api/hearing/use",
json={
"choice": "computer"
},
)
print(res.json())Response
{
"platform": "string",
"method": "string",
"problem": null,
"recommended": "computer",
"computer": {
"kind": "string",
"source": "string",
"why": "string",
"on": true,
"running": true,
"steps": [
{
"id": "string",
"label": "string",
"state": "ok"
}
]
},
"pi": {
"available": true,
"source": "string",
"label": "string",
"on": true
},
"capture": {},
"output": null
}{
"error": "Choose computer, mic or pi"
}{
"error": "Settings are locked. Unlock with the PIN in Settings."
}