SWAPI - Stardew Web API - let your game send events to a custom webhook

SWAPI - Stardew Web API - let your game send events to a custom webhook

15 Downloads

Stardew Valley Web API, let your game send events to a custom web server, useful for making discord bots, interactive web maps and so on !

You can use the in game configuration menu (via Generic Mod Config Menu) to configure the url of your server and the list of events you want the game to send to the server.

The list of events are all the events listed here : https://stardewvalleywiki.com/Modding:Modder_Guide/APIs/Events except the ones listed as "Specialised", the UpdateTicking, UpdateTicked and the drawing ones to not spam your server and/or lag the game.

The requests to the server are POST type and the event data are given as form parameters, data listed in the above link are sent to the server as string format with same name + an "eventName" key that let you identify the event : 



You can also as a developer call the api given to you to send custom requests with custom datas, here is the API interface : 



You can call it like this :

ISWAPIModApi api = ModEntry.Instance.Helper.ModRegistry.GetApi<ISWAPIModApi>("tomokisan.SWAPI");
var data = new Dictionary<string, string>
{
  { "eventName", "testEvent" },
  { "customData", "customValue" }
};

Task<string> response = api.sendRequestAsync("POST", data);

Require SMAPI : 

https://smapi.io/

My mods : 
SWAPI - Stardew Valley Web API : Let your game send events to a custom web server.
highRollerSlots : Add possibility to bet more in slots machines.
geodeCrusherPlus : Add ability to geode crusher to crush any geode, including mysteryboxes, Artifact Trove and golden coconuts.
TV Shopping channel : Add a TV shopping channel.
Prize Machine Custom Prizes : Let you easily fully customize the prize list of Prize Machine.
Better Statue Of Blessings : Allow you to get one blessing by statue per day instead of only one blessing per day.
Custom Blessings Framework : Allow mod developers to easily add blessings from statues of blessings.
Custom Wake Up Time : Let you configure the wake up time for each day.
Anti Tool Exhaustion : Prevent you to become exhausted from an accidental tool use.