I have a table of urls in BigQuery on which I would like to perform a check of PageSpeed Insights score (or even include the whole response from API in the BigQuery table). I tried to use UDFs for this purpuse, but for now no luck with this. Is there a way of getting the response from:
https://www.googleapis.com/pagespeedonline/v2/runPagespeed?url=https://google.com/&strategy=mobile&key=yourAPIKey
to BigQuery table?
You cannot make API calls from BigQuery UDFs for several reasons. See here for more details about that.
Although there are a few ways to achieve what you want to do, I'd recommend using a Cloud Dataflow pipeline:
BigQueryIO.Read
sourceParDo
, call the API you wantBigQueryIO.Write
sink