Open maceto opened 11 months ago
CREATE TEMPORARY FUNCTION GET_ADOPTION(
records ARRAY<STRUCT<
client STRING,
origins INT64
>>
) RETURNS STRUCT<
desktop INT64,
mobile INT64
> LANGUAGE js AS '''
return Object.fromEntries(records.map(({client, origins}) => {
return [client, origins];
}));
''';
SELECT
date,
app AS technology,
rank,
geo,
GET_ADOPTION(ARRAY_AGG(STRUCT(
client,
origins
))) AS adoption
FROM
`httparchive.core_web_vitals.technologies`
WHERE
date = '2023-07-01'
GROUP BY
date,
app,
rank,
geo
{
"date": "2023-07-01",
"technology": "WordPress",
"rank": "ALL",
"geo": "ALL",
"adoption": {
"desktop": "2040628",
"mobile": "3422903"
}
}
@rviscomi, should we have any mandatory
param for this endpoint?
Maybe just:
@sarahfossheim WDYT?
Example of how to consume this endpoint
curl --request GET \
--url 'https://dev-gw-2vzgiib6.ue.gateway.dev/v1/adoption?geo=Mexico&technology=["Blueshift","GoCache"]&rank=ALL'
Per our chat, try reformatting in the Python to this structure:
{
"Blueshift": [{"date": ...}],
"GoCache": []
}
@rviscomi @sarahfossheim, all the changes discussed are already deployed.
New URL https://dev-gw-2vzgiib6.uk.gateway.dev/v1/adoption
Documentation: https://github.com/HTTPArchive/tech-report-apis#get-adoption
Could you describe the origin/source of this data?
The goal is to create a script to query this data from BQ transform and save it in Firestore.