HTTP/1.1 200 OK Connection: close Content-Type: image/jpeg Content-disposition: attachment; filename="MEDIA_ID.jpg" Date: Sun, 06 Jan 2013 10:20:18 GMT Cache-Control: no-cache, must-revalidate Content-Length: 339721 Xxxx
{ "errcode": 40007, "errmsg": "invalid media_id"}
Range
来分块下载。curl ‘https://qyapi.weixin.qq.com/cgi-bin/media/get?access_token=ACCESS_TOKEN&media_id=MEDIA_ID’ -i -H “Range: bytes=0-1023”
GET /cgi-bin/media/get?access_token=ACCESS_TOKEN&media_id=MEDIA_ID HTTP/1.1
Host: qyapi.weixin.qq.com
Range: bytes 0-1023
HTTP/1.1 206 Partial Content
Accept-Ranges: bytes
Content-Range: bytes 0-1023/2048
Content-Length: 1024
…
(1024 Bites binary content)
206 Partial Content
,而非200 ok
Accept-Ranges
首部表示可用于定义范围的单位Content-Range
首部表示这一部分内容在整个资源中所处的位置curl --location --request GET 'https://qyapi.weixin.qq.com/cgi-bin/media/get'
{
"errcode": 40007,
"errmsg": "invalid media_id"
}