Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Want to pass multiple enum values for PageSpeed Insights API

I'm trying to use PageSpeed Insights API. The API Reference indicates that I can pass multiple category values when calling the API.

I issued the below command. Category values are separated with commas.

curl 'https://pagespeedonline.googleapis.com/pagespeedonline/v5/runPagespeed?key=<my key>&url=<my url>&category=ACCESSIBILITY,BEST_PRACTICES,PERFORMANCE,PWA,SEO'

The API responds with the below JSON.

{
  "error": {
    "code": 400,
    "message": "Invalid value at 'category' (TYPE_ENUM), \"ACCESSIBILITY,BEST_PRACTICES,PERFORMANCE,PWA,SEO\"",
    "errors": [
      {
        "message": "Invalid value at 'category' (TYPE_ENUM), \"ACCESSIBILITY,BEST_PRACTICES,PERFORMANCE,PWA,SEO\"",
        "reason": "invalid"
      }
    ],
    "status": "INVALID_ARGUMENT"
  }
}

I have no idea how I can pass multiple category values. Does anyone know how to do that?

like image 960
tmsick Avatar asked Oct 15 '25 22:10

tmsick


1 Answers

Pass as seperate parameter rather than comma seperated.

curl 'https://pagespeedonline.googleapis.com/pagespeedonline/v5/runPagespeed?key=<my key>&url=<my url>&category=ACCESSIBILITY&category=BEST_PRACTICES&category=PERFORMANCE&category=PWA&category=SEO'
like image 194
Sham Avatar answered Oct 18 '25 05:10

Sham



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!