【发布时间】:2018-06-29 18:24:55
【问题描述】:
我正在尝试了解 etag 如何与 Youtube API 配合使用。这是我提出的要求:
curl -X GET \
'https://www.googleapis.com/youtube/v3/channels?part=statistics&fields=items&id=UCmRtPmgnQ04CMUpSUqPfhxQ' \
-H 'Authorization: Bearer dezferfnr....' \
-H 'Cache-Control: no-cache' \
-H 'If-None-Match: \"g7k5f8kvn67Bsl8L-Bum53neIr4/4ygpLCFz2IoIJNkG3XO1Pys1hck\"'
这是我得到的回应:
{
"items": [
{
"kind": "youtube#channel",
"etag": "\"g7k5f8kvn67Bsl8L-Bum53neIr4/4ygpLCFz2IoIJNkG3XO1Pys1hck\"",
"id": "UCmRtPmgnQ04CMUpSUqPfhxQ",
"statistics": {
"viewCount": "4757859",
"commentCount": "63",
"subscriberCount": "68151",
"hiddenSubscriberCount": false,
"videoCount": "898"
}
}
]
}
如您所见,在响应中找到的 etag 与我在请求标头中发送的相同,我不明白为什么我没有收到 HTTP 304 响应(未修改)代替。
【问题讨论】:
标签: youtube-api youtube-data-api