iRacing is the leading online racing simulation for PC. During events hosted via the iRacing service there is a large amount of data created related to race results and member participation in events.
This library allows access via .NET to the iRacing "Data API". These APIs allow a properly authenticated user a supported method of accessing data from the service.
The library is distributed as the Aydsko.iRacingData NuGet package. Install using your package manager of choice.
To install using the dotnet command:
dotnet add package Aydsko.iRacingDataRegister the iRacing Data API client classes with the service provider.
services.AddiRacingDataApi(options =>
{
options.Username = "your-iracing-user@example.com";
options.Password = "Your-iRacing-Password";
options.UserAgentProductName = "MyApplicationName";
options.UserAgentProductVersion = new Version(1, 0);
});There is a change in the login algorithm due to be released with iRacing's 2022 Season 3 update. If this update has been released and authentication stops working enable the Use2022Season3Login flag on the options.
services.AddiRacingDataApi(options =>
{
options.Use2022Season3Login = true; // Add this line
options.Username = "your-iracing-user@example.com";
options.Password = "Your-iRacing-Password";
options.UserAgentProductName = "MyApplicationName";
options.UserAgentProductVersion = new Version(1, 0);
});Use the injected IDataClient to authenticate and request data.
public class ExampleService
{
private readonly IDataClient dataClient;
public ExampleService(IDataClient dataClient)
{
this.dataClient = dataClient;
}
public async Task<MemberInfo> GetMyInfoAsync(CancellationToken cancellationToken = default)
{
var infoResponse = await dataClient.GetMyInfoAsync(cancellationToken);
return infoResponse.Data;
}
}Before you begin a contribution, please read and ensure you are comfortable with this project's Code of Conduct.
To build & develop on the codebase you'll need:
- An active iRacing membership
- .NET 6 (or later)
To get started open and build src\iRacing Data API.sln.
