v1 end of life: raw.datafornerds.io will be retired on November 1, 2026. Migration guide →

C# Examples

Fetch and deserialize

using System.Text.Json;

using var client = new HttpClient();
var json = await client.GetStringAsync(
    "https://api.datafornerds.io/v2/microsoft/windows-update-history.json");
var doc = JsonDocument.Parse(json);

var metadata = doc.RootElement.GetProperty("metadata");
Console.WriteLine($"Dataset: {metadata.GetProperty("dataset")}");
Console.WriteLine($"Records: {metadata.GetProperty("recordCount")}");

// Filter to Windows 11 standard updates
foreach (var record in doc.RootElement.GetProperty("data").EnumerateArray()
    .Where(r => r.GetProperty("MajorVersion").GetInt32() == 11
             && r.GetProperty("ReleaseType").GetString() == "Standard")
    .OrderByDescending(r => r.GetProperty("ReleaseDate").GetString())
    .Take(5))
{
    Console.WriteLine($"  {record.GetProperty("ReleaseDate")}  " +
                      $"{record.GetProperty("KBNumber")}  " +
                      $"{record.GetProperty("OSBuild")}");
}

Strongly typed models

using System.Text.Json;
using System.Text.Json.Serialization;

var client = new HttpClient();
var response = await client.GetFromJsonAsync<ApiResponse<WindowsUpdate>>(
    "https://api.datafornerds.io/v2/microsoft/windows-11-update-history.json");

var latest = response!.Data
    .Where(u => u.ReleaseType == "Standard")
    .OrderByDescending(u => u.ReleaseDate)
    .First();

Console.WriteLine($"Latest: {latest.KBNumber} ({latest.OSBuild}) - {latest.ReleaseDate}");

record ApiResponse<T>(Metadata Metadata, T[] Data);
record Metadata(string Provider, string ApiVersion, string Dataset, int RecordCount);
record WindowsUpdate(
    string OSType, int MajorVersion, string WindowsVersion,
    string KBNumber, string OSBuild, string FullVersion,
    string ReleaseDate, string ReleaseType, bool IsExpired, string ArticleUrl);

Conditional requests with ETag

using var client = new HttpClient();
string? etag = null;

async Task<JsonDocument?> GetUpdatesIfChanged()
{
    var request = new HttpRequestMessage(HttpMethod.Get,
        "https://api.datafornerds.io/v2/microsoft/windows-update-history.json");
    if (etag != null)
        request.Headers.IfNoneMatch.ParseAdd(etag);

    var response = await client.SendAsync(request);

    if (response.StatusCode == System.Net.HttpStatusCode.NotModified)
    {
        Console.WriteLine("No changes");
        return null;
    }

    response.EnsureSuccessStatusCode();
    etag = response.Headers.ETag?.Tag;
    var json = await response.Content.ReadAsStringAsync();
    return JsonDocument.Parse(json);
}