getCurrent* methods in Spinitron API v2

So, the getCurrent* methods aren’t present in the new API, and I’m assuming that they’re somehow implicit. I’m just hoping for a sanity-check on how.

Out of the resources available in the new API, how can I tell which spin, playlist, etc are the current one? The list resources in the Swagger UI state that only old ones will be returned. Is there anywhere on the server I may be able to infer this information?

I was thinking I could, for example do a little date math to find the current Show and look at its playlists, but I don’t want to overengineer things without understanding the big picture.

I notice that we can POST data to the new API, so is it expected that the client decide what’s “current” and provide that information?

Thanks for your time!

Chad

Last things first

No. POST /spins is for logging spins into playlists. It’s mainly used by automation systems. Not relevant to web integration.

We don’t use the adjective current in the API anymore. But you can easily get the most recent spin or playlist and look at the timestamp to decide for yourself if it is current.

If your request doesn’t have start or end search parameters then

  • GET /spins returns spins in reverse chronological order starting from NOW including any already started.
  • GET /playlists returns playlists in reverse chronological order starting from NOW including any already started.
  • GET /shows returns scheduled show occurrences in forwards chronological order starting NOW and including any that haven’t yet ended.

(NOW = server time when processing the request in the station’s timezone.)

So GET /spins?count=1 returns the most recent spin. GET /playlists?count=1 returns the most recently started playlist. The spin/playlist may or may not have ended. You can tell from the start and end fields in the response.

GET /shows?count=1 returns the oldest scheduled show occurrence with an end in the future.

Note for advanced users: For each entity type there can be zero, one or more item that’s current in the sense that start ≤ NOW < end. If you use ?count=1 you’ll only see one of them, the most recently started/created.

API reference: https://spinitron.github.io/v2api/

Tom,

This rules and completely answers my question. Thanks a ton!

Take care,

Chad