Filter channels by categoryId using YouTube API

Viewed 40

I am trying to filter channels by categoryId with the youtube API

When I do not include categoryId in my query params I get the following, which is to be expected.

https://www.googleapis.com/youtube/v3/channels?key=(MY_API_KEY_HERE)&categoryId=1&part=id,status,snippet,brandingSettings

{
    "error": {
        "code": 400,
        "message": "No filter selected. Expected one of: mySubscribers, categoryId, mine, id, forUsername, managedByMe",
        "errors": [
            {
                "message": "No filter selected. Expected one of: mySubscribers, categoryId, mine, id, forUsername, managedByMe",
                "domain": "youtube.parameter",
                "reason": "missingRequiredParameter",
                "location": "parameters.",
                "locationType": "other"
            }
        ]
    }
}

If I enter a categoryId in the query params using any of the categories I get from this list, though, then I get the following result, which doesn’t make sense since I would assume the categoryId is a filter. So why is it None?

https://www.googleapis.com/youtube/v3/channels?key=(MY_API_KEY_HERE)&categoryId=1&part=id,status,snippet,brandingSettings

https://www.googleapis.com/youtube/v3/videoCategories?part=snippet&regionCode=CA&key=(MY_API_KEY_HERE)

{
    "error": {
        "code": 400,
        "message": "Request contains an invalid argument.",
        "errors": [
            {
                "domain": "youtube.api.CommonRequestError",
                "reason": "ERROR_FILTER_NONE_SELECTED"
            }
        ],
        "status": "INVALID_ARGUMENT"
    }
}
0 Answers
Related