Now playing
Change now playing
PATCH
/api/nowplayingAdmin. Needs an unlock token (
x-tempolight-token) while a PIN lock is set; without a lock, anyone can call it.Turns it on or off, and sets the Spotify app's Client ID.
Request body application/json
enabledbooleanspotifyClientIdstring32 hex digits, from developer.spotify.com/dashboard.
Responses
200OKapplication/json
enabledbooleansupportedbooleanplatformstringstatestringOne of
"ok" "starting" "unavailable" "error" "off"messagestring | nullmethodstring | nullOne of
"osascript" "playerctl" "dbus-send" "powershell" nulltrackobject | null{source, app, device, title, artist, album, dur, pos, playing, posKnown, remembered, following}.
spotifyobject400The 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 PATCH 'http://localhost:8080/api/nowplaying' \
-H 'content-type: application/json' \
-d '{
"enabled": true
}'const res = await fetch("http://localhost:8080/api/nowplaying", {
method: "PATCH",
headers: { "content-type": "application/json" },
body: JSON.stringify({
"enabled": true
}),
});
const data = await res.json();
console.log(data);import requests
res = requests.patch(
"http://localhost:8080/api/nowplaying",
json={
"enabled": True
},
)
print(res.json())Response
{
"enabled": true,
"supported": true,
"platform": "darwin",
"state": "ok",
"message": null,
"method": "osascript",
"track": null,
"spotify": {
"clientId": "",
"connected": false,
"error": null,
"redirectUri": "http://127.0.0.1:8080/api/nowplaying/spotify/callback"
}
}{
"error": "A Spotify Client ID is 32 letters and digits (0-9, a-f), from developer.spotify.com/dashboard"
}{
"error": "Settings are locked. Unlock with the PIN in Settings."
}