© 2024 Daan Schenkel & Oscar Knap - Alle rechten voorbehouden

League-FM public api use

Download

Introduction (READ CAREFULLY!)

In this file, the public websocket events and some information about the public endpoints are listed. Please make sure to read this whole file before using them, as there is importing information here.

Anyone is free to use any of the public endpoints/websocket for their own use. (As long as they're not spamming or misusing them).

Contact

For general contact, join the League-FM Discord server: https://discord.gg/league-fm-521025926322978827 or contact Daan Schenkel on https://dandandev.xyz/.

General information

Public endpoints

🚨MAKE SURE TO ALWAYS PARSE THE ERROR WHEN SUCCESS IS FALSE!🚨

All public endpoints (and some information about them like examples) are listed on https://api.league-fm.nl/docs.

Some more general information about the endpoints:

The server will always give one of 2 responses, depending on whether the request was successful.

{
  "success": true,
  "data": "..."
}

or

{
  "success": false,
  "error": "..."
}

Please always handle the error correctly when success is false (by for example showing it to the user). The error is always in Dutch. In addition to the error, there could also be an extraInfo which contains some extra information about the error.

There may also be a warning in any response (no matter if it was successful or not) about the use of the endpoint.

Public websocket

To get notified about:

you could use the public websocket. We use socket.io for this. To use this websocket, connect with socket.io to the api origin (https://api.league-fm.nl) and you'll receive the websocket events.

Below is a list of the possible events and their data.


nowPlaying

Comes with information about which song is currently being played.


songRequestsOpen

Comes with a boolean whether the song requests are currently open or closed.


scheduleUpdate

This is only being sent when the schedule is changed, so NOT EVERY HOUR. This event comes with no information. You're expected to refetch and display the new schedule yourself when receiving this event. If you fetch shows which are upcoming (so based on the current time) you also need to refetch the schedule every hour by yourself.


top20Update

This is sent when the top20 changes. This event comes with no information. You're expected to refetch and display the new top 20 yourself when receiving this event.


bannersUpdate

This is sent when the banners change. This event comes with no information. You're expected to refetch and display the new banners yourself when receiving this event.


clockedIn

This is sent when a dj clocks in and out. Some information about the dj and whether this was a clock in or a clock out is sent.