BW Web API (rust edition)
A Rust library for interacting with the StarCraft Brood War API.
This is a port of the bw-web-api library, which is written in TypeScript. You can find more information there such as endpoint documentation, the expected shape of responses, etc.
Not every endpoint is working yet and this is still a work in progress. However, the most useful endpoints are implemented and working (eg. aurora_profile_by_toon
).
Installation
cargo add bw-web-api-rs
Usage
This library makes use of async/await, so you will need to use your preferred async runtime, such as tokio.
use ;
async
You can find rough documentation for the endpoints here.
StarCraft Port
The port StarCraft opens for the web API will not always be the same. You can determine the port on Windows via:
(as administrator)
(Get-NetTCPConnection -OwningProcess (Get-Process -Name StarCraft | Select-Object -ExpandProperty Id) | Where-Object {$_.State -eq "Listen"} | Sort-Object -Property LocalPort | Select-Object -First 1).LocalPort
An example of running this command in Rust:
use Command;
use str;