WIP: feat: add /v1/geo-breakdown endpoint for geographic CWV breakdown#94
WIP: feat: add /v1/geo-breakdown endpoint for geographic CWV breakdown#94alonkochba wants to merge 2 commits intoHTTPArchive:mainfrom
Conversation
Adds a new controller and route that returns core_web_vitals data for all geographies for a given technology. Unlike /cwv, this endpoint omits the geo filter so callers can build a geographic breakdown chart without issuing one request per country.
|
@max-ostapenko could you give you opinion on this before @alonkochba takes it much further? I like the idea, and landing the API first will allow the front-end changes to be tested. Questions I have are:
|
| * Query params: | ||
| * technology (required) | ||
| * rank (default: ALL) | ||
| * start (optional; 'latest' resolves to the most recent date) |
There was a problem hiding this comment.
Maybe it doesn’t make sense to support this. It should be according to a single month of data and not multiple months probably.
There was a problem hiding this comment.
Based on your visualization example it seems that a single monthly snapshot is sufficient.
1 month of CWV data is 15Kb btw.
|
@alonkochba let's add the cross-geo implementation to the existing Define and verify the parameter combinations definition (in order to have a bounded set of results):
This will allow to later extend the visualization with any of the existing metrics. |
|
Thanks, updating. Is it really a good idea to make start/end required though? and the default is usually 7 years of data (start is 2020, end is latest), seems like a waste to serve this API for all period for now if we only display last month Updated suggestion to only use end date (or latest if not given) for now wdyt? |
Add crossGeo option to createReportController; delete standalone geoBreakdownController.js. Endpoint now returns a single-month snapshot (latest by default, or the month specified by the end param).

Companion to HTTPArchive/httparchive.org#1220, implementing HTTPArchive/httparchive.org#1146.
Summary
Adds a new
/v1/geo-breakdownendpoint that returns Core Web Vitals data for all geographies for a given technology. Unlike/v1/cwv, this endpoint omits the geo filter so callers can build a geographic breakdown chart without issuing one request per country.Changes
src/controllers/geoBreakdownController.js— new controller; queriescore_web_vitalswithout a geo filter, includesgeoin the field projectionsrc/index.js— wires upGET /v1/geo-breakdownAPI
Parameters mirror
/v1/cwvexceptgeois not accepted (all geographies are returned):technologyALLrankALLstartlatest)endResponse format is identical to
/v1/cwvwith an additionalgeofield per record.