I'm using Guzzle 6 to communicate with the Youtube API.
I've read about the etags in the YoutubeAPI docs and tried to make it work for me.
First, I tested it at the OAuth 2.0 Playground by Google.
After a few tries I had set it up and the result was following:
It returned successfully 304 for this particular request.
Now I've used this code to recreate above response.
$this->client->get('https://www.googleapis.com/youtube/v3/playlists?part=id,snippet&id=PLQvsw2H5Quochc6RgdIO-zvTKB012BTz1&key=MyApiKey', [
'header' => [
'If-none-match' => "\"DsOZ7qVJA4mxdTxZeNzis6uE6ck/FVDC5fyfcQ3KmIbwFIpgNgWJFUo\"",
]
]);
But it always returns an response with a 200 code.
I don't know alot about the HTTP protocol and therefore I'm not sure if I'm missing something..
(either calling with Guzzle or the headers itself)
At first glance, it looks like your request is failing the authentication portion of the request, based upon the fact that the copy and pasted image lists authentication yet it is not within your code snippet. It is hard to tell without being able to view the full response received.
Use auth to enable authentication for the transaction. Use debug to enable debugging, this will allow you to compare the request and responses received by Guzzle with expectations.
You might also be interested in utilizing the Official Google PHP Client library. At the core this library uses Guzzle.