Aydsko.iRacingData
2404.5.0
dotnet add package Aydsko.iRacingData --version 2404.5.0
NuGet\Install-Package Aydsko.iRacingData -Version 2404.5.0
<PackageReference Include="Aydsko.iRacingData" Version="2404.5.0" />
paket add Aydsko.iRacingData --version 2404.5.0
#r "nuget: Aydsko.iRacingData, 2404.5.0"
// Install Aydsko.iRacingData as a Cake Addin #addin nuget:?package=Aydsko.iRacingData&version=2404.5.0 // Install Aydsko.iRacingData as a Cake Tool #tool nuget:?package=Aydsko.iRacingData&version=2404.5.0
Aydsko iRacing Data API
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.
⚠ Upcoming Multi-Factor Authentication Requirement
iRacing has announced that they will be requiring multi-factor authentication (MFA) for all users by default. This will affect the ability to use the iRacing Data API by logging in with a username or password.
In the immediate future, use of the Data API will be supported by enabling "Legacy Authentication" in your iRacing account settings. iRacing will advise next steps for the authentication of applications for the Data API later on.
To continue to use this library you must enable "Legacy Authentication" in your iRacing account settings before attempting to authenticate. Please do not enable this setting unless you require it, as it may reduce the security on your iRacing account.
Getting Started
1. Install the Aydsko iRacing Data API library.
The library is distributed as the Aydsko.iRacingData
NuGet package. Install using your package manager of choice.
dotnet add package Aydsko.iRacingData
2. Register the client.
Register the iRacing Data API client classes with the service provider.
services.AddIRacingDataApi(options =>
{
options.UserAgentProductName = "MyApplicationName";
options.UserAgentProductVersion = new Version(1, 0);
});
3. Use the client.
Use the IDataClient
from the service provider to authenticate and request data.
// Retrieve an instance from the service provider.
var dataClient = serviceProvider.GetRequiredService<IDataClient>();
// Supply your iRacing username and password.
dataClient.UseUsernameAndPassword(iRacingUsername, iRacingPassword);
// Retrieve information about our own account.
var infoResponse = await dataClient.GetMyInfoAsync(cancellationToken);
// Write that information to the console.
Console.WriteLine($"Driver name: {infoResponse.Data.DisplayName}");
Console.WriteLine($"Customer ID: {infoResponse.Data.CustomerId}");
Console.WriteLine($"Club: {infoResponse.Data.ClubName}");
Enable Caching of Results
1. Add the Microsoft memory caching package.
dotnet add package Microsoft.Extensions.Caching.Memory
2. Register the memory caching library with the service provider.
services.AddMemoryCache();
3. Register the caching client.
Register the iRacing Data API caching client classes with the service provider.
services.AddIRacingDataApiWithCaching(options =>
{
options.UserAgentProductName = "MyApplicationName";
options.UserAgentProductVersion = new Version(1, 0);
});
Then simply use the IDataClient
as before.
Versioning
Ideally you should always use the latest version of the library that is available. This is because iRacing will sometimes introduce API changes during a release which make the old code incompatible.
This library will use version numbers will be in the format:
[YY][SS].[R]
Where:
- YY = two digit year
- SS = the iRacing season the library release was made in as a zero-padded number (i.e. 01, 02, 03, 04)
- R = release number, which increments when changes are made although it may not be sequential
Example:
- 2303.1 = changes compatible with iRacing 2023 Season 3 or later, and is release 1 during this season
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Microsoft.Extensions.Caching.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Http (>= 8.0.1)
- System.Net.Http.Json (>= 8.0.1)
- System.Text.Json (>= 8.0.5)
-
net6.0
- Microsoft.Extensions.Caching.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Http (>= 8.0.1)
-
net8.0
- Microsoft.Extensions.Caching.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Http (>= 8.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated | |
---|---|---|---|
2404.5.0 | 91 | 11/9/2024 | |
2404.5.0-beta | 75 | 11/2/2024 | |
2404.4.0 | 267 | 10/15/2024 | |
2404.3.0 | 91 | 10/10/2024 | |
2404.2.1 | 111 | 9/29/2024 | |
2404.2.0 | 86 | 9/29/2024 | |
2404.0.0 | 243 | 9/9/2024 | |
2403.3.0 | 180 | 9/3/2024 | |
2403.2.0 | 173 | 8/4/2024 | |
2403.1.0 | 191 | 7/2/2024 | |
2403.0.0 | 205 | 6/13/2024 | |
2402.2.0 | 355 | 5/1/2024 | |
2402.1.0 | 131 | 4/20/2024 | |
2304.1.0 | 1,112 | 11/27/2023 | |
2303.1.0 | 642 | 8/2/2023 | |
2303.0.0 | 457 | 6/19/2023 | |
0.10.0 | 248 | 5/4/2023 | |
0.9.2 | 352 | 4/9/2023 | |
0.9.1 | 186 | 4/8/2023 | |
0.9.0 | 280 | 4/7/2023 | |
0.8.0 | 320 | 3/12/2023 | |
0.7.3 | 306 | 2/24/2023 | |
0.7.2 | 300 | 2/9/2023 | |
0.7.1 | 254 | 2/6/2023 | |
0.7.0 | 296 | 12/23/2022 | |
0.6.4 | 498 | 11/27/2022 | |
0.6.3 | 322 | 11/27/2022 | |
0.6.2 | 553 | 10/12/2022 | |
0.6.1 | 429 | 9/28/2022 | |
0.6.0 | 532 | 9/24/2022 | |
0.5.1 | 405 | 9/19/2022 | |
0.5.0 | 437 | 9/11/2022 | |
0.4.1 | 638 | 7/11/2022 | |
0.4.0 | 528 | 7/3/2022 | |
0.3.0 | 450 | 6/1/2022 | |
0.2.0 | 459 | 4/25/2022 | |
0.1.2 | 447 | 4/14/2022 | |
0.1.1 | 451 | 4/9/2022 | |
0.1.0 | 439 | 3/26/2022 | |
0.0.8 | 439 | 3/23/2022 | |
0.0.7 | 437 | 3/5/2022 | |
0.0.6 | 446 | 3/3/2022 | |
0.0.5 | 439 | 2/27/2022 | |
0.0.4 | 457 | 2/24/2022 |
BREAKING CHANGES:
iRacing has enabled two-factor authentication by default. To continue to use this library you must enable "Legacy Authentication" in your iRacing account settings before attempting to authenticate. Please do not enable this setting unless you require it, as it may reduce the security on your iRacing account.
Fixes / Changes:
- Add "/data/stats/season_supersession_standings" Endpoint (Issue: #22)
- Unauthorized Responses Do Not Retry And Calls Continue To Fail (Issue: #231)
- Implemented a retry mechanism for 401 Unauthorized responses
- If a request fails with a 401 Unauthorized response, the library will attempt to re-authenticate and retry the request 2 more times
- If the request continues to fail after 3 attempts, the library will throw an "iRacingUnauthorizedResponseException"
- Included .NET Diagnostics "Activity" for API Calls
- All API calls are now wrapped in a .NET Diagnostics "Activity" to provide more detailed information in the logs
- This will allow you to see the duration of the API call, the endpoint that was called, and the status code of the response
- See "Distributed Tracing" on Microsoft Learn for more information: https://learn.microsoft.com/en-au/dotnet/core/diagnostics/distributed-tracing