想要为 PageSpeed Insights API 传递多个枚举值
Want to pass multiple enum values for PageSpeed Insights API
我正在尝试使用 PageSpeed Insights API。调用 API.
时的 API Reference indicates that I can pass multiple category 值
我发出了以下命令。类别值以逗号分隔。
curl 'https://pagespeedonline.googleapis.com/pagespeedonline/v5/runPagespeed?key=<my key>&url=<my url>&category=ACCESSIBILITY,BEST_PRACTICES,PERFORMANCE,PWA,SEO'
API 响应如下 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"
}
}
我不知道如何传递多个类别值。有人知道怎么做吗?
作为单独的参数传递,而不是逗号分隔。
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'
我正在尝试使用 PageSpeed Insights API。调用 API.
时的 API Reference indicates that I can pass multiple category 值我发出了以下命令。类别值以逗号分隔。
curl 'https://pagespeedonline.googleapis.com/pagespeedonline/v5/runPagespeed?key=<my key>&url=<my url>&category=ACCESSIBILITY,BEST_PRACTICES,PERFORMANCE,PWA,SEO'
API 响应如下 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"
}
}
我不知道如何传递多个类别值。有人知道怎么做吗?
作为单独的参数传递,而不是逗号分隔。
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'