A DotNet Standard C# PonyTown API Wrapper
- Install the library from Nuget or this repository
- Get the servers list and status
- Get the account informations
- Get the account ponies
- Pony data parsing
- OAuth2 support
- Friends list
- Simple bot implementation
- Get the servers list
using DotNetPonies;
var client = new PonyTownClient();
// Resolve api version by searching in the pony town javascript code.
await client.ResolveApiVersionAsync();
var status = await client.GetStatusAsync();
foreach (var server in status.Servers)
{
Console.WriteLine($"{server.Id} - {server.OnlineCount} players");
}
- Get all pony for an account
using DotNetPonies;
var client = new PonyTownClient();
// Resolve api version by searching in the pony town javascript code.
await client.ResolveApiVersionAsync();
// Login with your pony town account (cookie)
client.LoginWithCookie("<connect_sid>", "<remember_me>");
var ponies = await client.GetCharactersAsync("<account_id>", "<account_name>");
foreach (var pony in ponies)
{
Console.WriteLine(pony.Name);
}
PonyTown API V2 is using a api-version header to validate a lot of request, in this case the api-version is not valid anymore for this build, it will be necessary to get it manually.
- First you need to go on pony town website and login.
- Open the chrome/firefox dev tool with F12.
- Go on the network tab
- Reload your page
- Go on the https://pony.town/api1/account ressource (or https://pony.town/api2/game/status if you have clicked on the server selector)
- Get the api-version header
- Create your client with this api version
var client = new PonyTownClient(new PonyTownScope { DefaultApiVersion = "<api-version>" });