API - mcmerdith/Spigot-LiveCheck GitHub Wiki

API Documentation

The plugin references a URL defined in the config by PREFS_API_URL (preferences.api_url)

If the URL is invalid, the API server encounters an error, or the API server is down, the plugin will timeout the request

If a timeout occurs, the plugin will halt execution for 60 seconds (1200 ticks) and the event will be logged to the console

Making an API call

To make an API call, the appends the players linked Twitch username to PREFS_API_URL

Example

If PREFS_API_URL is set to 'https://api.mcmerdith.net/twitch?name=' the plugin would make the following request to check if Twitch user 'mcmerdith' is streaming:

https://api.mcmerdith.net/twitch?name=mcmerdith

API Response Format

The plugin expects a result formatted as a JSON object with 2 fields: online (boolean) and viewers (integer)

Example: {"online":true,"viewers":10}

If the API Response is invalid, the user will be ignored for that cycle