I send a request to https://www.googleapis.com/batch/youtube/v3, but I get a 404 anyway. Perhaps I am sending the request incorrectly, but most likely the endpoint is not working.
As well as, I use Postman to test with next creds:
1. POST request to https://www.googleapis.com/batch/youtube/v3.
2. Set "Content-type" header to multipart/mixed.
3. Add raw text body with as HTTP:
GET https://www.googleapis.com/youtube/v3/channels?part=snippet&id=2222222&key=* HTTP/1.1
Accept: application/json
Content-Type: application/json; charset=UTF-8
GET https://www.googleapis.com/youtube/v3/channels?part=snippet&id=1111111&key=* HTTP/1.1
Accept: application/json
Content-Type: application/json; charset=UTF-8
Any suggestions for NodeJS?
YouTube Data API version 3 does support batch processing only of the following form:
Batch processing – The v3 API supports one of the batch processing use cases that the v2 API had supported. The v3 API's
channels.list
,channelSections.list
,guideCategories.list
,playlistItems.list
,playlists.list
,subscriptions.list
,videoCategories.list
, andvideos.list
methods all support an id parameter, which can be used to specify a comma-delimited list of IDs (video IDs, channel IDs, etc.). Using those methods, you can retrieve a list of multiple resources with a single request.
According to the docs, in case of Channels.list
API endpoint, you're able to batch several calls, since, the id
property accepts multiple channel IDs in one go:
id (string)
Theid
parameter specifies a comma-separated list of the YouTube channel ID(s) for the resource(s) that are being retrieved. In achannel
resource, theid
property specifies the channel's YouTube channel ID.
Note that the API provided me with the following response when asking the Videos.list
endpoint to produce info for 64 videos in one go (even only 51 produced the same response):
ERROR 400: Bad Request
{
"error": {
"code": 400,
"message": "The request specifies an invalid filter parameter.",
"errors": [
{
"message": "The request specifies an invalid filter parameter.",
"domain": "youtube.parameter",
"reason": "invalidFilters",
"location": "parameters.",
"locationType": "other"
}
]
}
}
Therefore this API endpoint does not accept more than 50 IDs. It's very much presumable that the others will function the same way.