This is a wrapper for the iRacing API service written in C#. It is still early in development. Use at your own risk and please report issues so they can be fixed. Thanks!
There are periodic updates to the iRacing API and I do not know how to track these updates. If you encounter any issues or have suggestions for improvements, please submit them via the GitHub issue tracker.
- Go to the Issues section of the repository.
- Click on the
New Issue
button. - Provide a clear and descriptive title for your issue.
- Fill out the issue template with as much detail as possible, including steps to reproduce the issue, expected behavior, and any relevant screenshots or logs.
- Submit the issue.
The IRacingApiService
is a service for interfacing with the iRacing API. It uses authentication and logging mechanisms to provide a reliable and secure way to interact with iRacing data.
iRacing adopted 2FA in 2024 and requires you to now opt-in to legacy authentication.
- Goto https://oauth.iracing.com/accountmanagement/security/
- At the bottom of the options, enable Legacy Authentication
To use the IRacingApiService
, follow these steps:
-
Install necessary packages:
dotnet add package Microsoft.Extensions.Options dotnet add package Microsoft.Extensions.Logging
-
Configure settings:
Create a configuration section in your
appsettings.json
file:{ "IRacingDataSettings": { "BaseUrl": "https://members-ng.iracing.com/", "Username": "your_username", "Password": "your_password" } }
-
Register services:
In your
Startup.cs
orProgram.cs
file, register the necessary services:public void ConfigureServices(IServiceCollection services) { services.Configure<IRacingDataSettings>(Configuration.GetSection("IRacingDataSettings")); services.AddSingleton<IRacingApiService>(); services.AddLogging(); }
-
Use the service:
Inject and use the
IRacingApiService
in your application:public class RacingController : ControllerBase { private readonly IRacingApiService _racingApiService; public RacingController(IRacingApiService racingApiService) { _racingApiService = racingApiService; } // Your actions using IRacingApiService }
There is a test project called TestWrapper that shows how to set this up in a console app.
- Ensure you have the correct iRacing API credentials.
- Handle exceptions and errors appropriately in your application.
- Any suggestions on improving this project or the readme? Submit an issue, thanks!