JavaScript Examples
Fetch and filter (browser or Node.js)
const response = await fetch('https://api.datafornerds.io/v2/microsoft/windows-update-history.json');
const { metadata, data } = await response.json();
console.log(`${metadata.dataset}: ${metadata.recordCount} records`);
const win11Standard = data
.filter(r => r.MajorVersion === 11 && r.ReleaseType === 'Standard')
.sort((a, b) => b.ReleaseDate.localeCompare(a.ReleaseDate))
.slice(0, 5);
console.table(win11Standard.map(r => ({
Date: r.ReleaseDate,
KB: r.KBNumber,
Build: r.OSBuild,
})));
Build a lookup Map
const { data } = await fetch('https://api.datafornerds.io/v2/microsoft/language-codes.json')
.then(r => r.json());
const lcidMap = new Map(data.map(r => [r.LanguageCode, r]));
const english = lcidMap.get('1033');
console.log(english.BCP47); // en-US
console.log(english.Description); // English - United States
Efficient polling with ETag
let etag = null;
async function getUpdatesIfChanged() {
const headers = etag ? { 'If-None-Match': etag } : {};
const response = await fetch(
'https://api.datafornerds.io/v2/microsoft/windows-update-history.json',
{ headers }
);
if (response.status === 304) {
console.log('No changes');
return null;
}
etag = response.headers.get('ETag');
const data = await response.json();
console.log(`Updated: ${data.metadata.recordCount} records`);
return data;
}
Node.js: save to file
import { writeFile } from 'node:fs/promises';
const response = await fetch('https://api.datafornerds.io/v2/microsoft/m365-apps-update-history.json');
const payload = await response.json();
const current = payload.data
.filter(r => r.ChannelName === 'Current Channel')
.sort((a, b) => b.ReleaseDate.localeCompare(a.ReleaseDate));
await writeFile('m365-current-channel.json', JSON.stringify(current, null, 2));
console.log(`Saved ${current.length} records`);