Recently played tracks API call

Is there an API call that can list tracks played in the last X hours? I am trying to replace the following SQL call in a script we have with an API call.

SELECT items.idx, playlistlog.starttime
FROM items
JOIN playlistlog ON playlistlog.item = items.idx
WHERE items.type = 'Music'
AND playlistlog.starttime >= DATEADD(hour, -2, CONVERT(DATETIME,GETDATE() AT TIME ZONE (SELECT CURRENT_TIMEZONE_ID()) AT TIME ZONE 'GMT Standard Time'))
AND items.artist = ?
ORDER BY playlistlog.starttime DESC

(The script just changes the color, icon, and comment of a file depending on track/artist/artist group rotation policy so presenters know whether it can be played)

By API, you mean the HTTP API of DBServer?

GET /api/v1/playlistlog?firstday=YYYY-MM-DD&lastday=YYYY-MM-DD

Yes - That worked perfectly :slight_smile: Thank you.

2 Likes