我正在使用Vimeo API,同时进行get调用以访问我正在执行的用户视频
https://api.vimeo.com/users/61402929/videos?access_token=token
这将返回一个json响应
{ "total": 1, "page": 1, "per_page": 25, "paging": { "next": null, "previous": null, "first": "/users/61402929/videos?access_token=365879aad6244864dab70902890fc1a1&page=1", "last": "/users/61402929/videos?access_token=365879aad6244864dab70902890fc1a1&page=1" }, "data": [ { "uri": "/videos/200383630", "name": "Bhuvan bam _ Bb ki vines _ playing piano _ Saagar jaisi aankhon waali _ bhuvan bam live (360p_30fps_H264-96kbit_AAC)", "description": "BB Ki Vines", "link": "https://vimeo.com/200383630", "duration": 59, "width": 320, "language": null, "height": 320, "embed": { "uri": null, "html": "", "buttons": { "like": true, "watchlater": true, "share": true, "embed": true, "hd": false, "fullscreen": true, "scaling": true }, "logos": { "vimeo": true, "custom": { "active": false, "link": null, "sticky": false } }, "title": { "name": "user", "owner": "user", "portrait": "user" }, "playbar": true, "volume": true, "color": "00adef" }, "created_time": "2017-01-20T17:57:04+00:00", "modified_time": "2017-01-20T17:58:41+00:00", "release_time": "2017-01-20T17:57:04+00:00", "content_rating": [ "unrated" ], "license": null, "privacy": { "view": "anybody", "embed": "public", "download": true, "add": true, "comments": "anybody" }, "pictures": { "uri": "/videos/200383630/pictures/613872508", "active": true, "type": "custom", "sizes": [ { "width": 100, "height": 75, "link": "https://i.vimeocdn.com/video/613872508_100x75.webp?r=pad", "link_with_play_button": "https://i.vimeocdn.com/filter/overlay?src0=https%3A%2F%2Fi.vimeocdn.com%2Fvideo%2F613872508_100x75.webp&src1=http%3A%2F%2Ff.vimeocdn.com%2Fp%2Fimages%2Fcrawler_play.png" }, { "width": 200, "height": 150, "link": "https://i.vimeocdn.com/video/613872508_200x150.webp?r=pad", "link_with_play_button": "https://i.vimeocdn.com/filter/overlay?src0=https%3A%2F%2Fi.vimeocdn.com%2Fvideo%2F613872508_200x150.webp&src1=http%3A%2F%2Ff.vimeocdn.com%2Fp%2Fimages%2Fcrawler_play.png" }, { "width": 295, "height": 166, "link": "https://i.vimeocdn.com/video/613872508_295x166.webp?r=pad", "link_with_play_button": "https://i.vimeocdn.com/filter/overlay?src0=https%3A%2F%2Fi.vimeocdn.com%2Fvideo%2F613872508_295x166.webp&src1=http%3A%2F%2Ff.vimeocdn.com%2Fp%2Fimages%2Fcrawler_play.png" }, { "width": 640, "height": 640, "link": "https://i.vimeocdn.com/video/613872508_640x640.webp?r=pad", "link_with_play_button": "https://i.vimeocdn.com/filter/overlay?src0=https%3A%2F%2Fi.vimeocdn.com%2Fvideo%2F613872508_640x640.webp&src1=http%3A%2F%2Ff.vimeocdn.com%2Fp%2Fimages%2Fcrawler_play.png" }, { "width": 960, "height": 960, "link": "https://i.vimeocdn.com/video/613872508_960x960.webp?r=pad", "link_with_play_button": "https://i.vimeocdn.com/filter/overlay?src0=https%3A%2F%2Fi.vimeocdn.com%2Fvideo%2F613872508_960x960.webp&src1=http%3A%2F%2Ff.vimeocdn.com%2Fp%2Fimages%2Fcrawler_play.png" } ], "resource_key": "fdb74e1e2dcaf7c929cfe14240765f45f2d2a302" }, "tags": [], "stats": { "plays": 0 }, "metadata": { "connections": { "comments": { "uri": "/videos/200383630/comments", "options": [ "GET", "POST" ], "total": 0 }, "credits": { "uri": "/videos/200383630/credits", "options": [ "GET", "POST" ], "total": 1 }, "likes": { "uri": "/videos/200383630/likes", "options": [ "GET" ], "total": 0 }, "pictures": { "uri": "/videos/200383630/pictures", "options": [ "GET", "POST" ], "total": 1 }, "texttracks": { "uri": "/videos/200383630/texttracks", "options": [ "GET", "POST" ], "total": 0 }, "related": null }, "interactions": { "watchlater": { "added": false, "added_time": null, "uri": "/users/61402929/watchlater/200383630" } } }, "user": { "uri": "/users/61402929", "name": "Rishabh Kumar", "link": "https://vimeo.com/user61402929", "location": null, "bio": null, "created_time": "2017-01-11T16:15:43+00:00", "account": "basic", "pictures": null, "websites": [], "metadata": { "connections": { "activities": { "uri": "/users/61402929/activities", "options": [ "GET" ] }, "albums": { "uri": "/users/61402929/albums", "options": [ "GET" ], "total": 0 }, "appearances": { "uri": "/users/61402929/appearances", "options": [ "GET" ], "total": 0 }, "categories": { "uri": "/users/61402929/categories", "options": [ "GET" ], "total": 0 }, "channels": { "uri": "/users/61402929/channels", "options": [ "GET" ], "total": 0 }, "feed": { "uri": "/users/61402929/feed", "options": [ "GET" ] }, "followers": { "uri": "/users/61402929/followers", "options": [ "GET" ], "total": 0 }, "following": { "uri": "/users/61402929/following", "options": [ "GET" ], "total": 0 }, "groups": { "uri": "/users/61402929/groups", "options": [ "GET" ], "total": 0 }, "likes": { "uri": "/users/61402929/likes", "options": [ "GET" ], "total": 0 }, "moderated_channels": { "uri": "/users/61402929/channels?filter=moderated", "options": [ "GET" ], "total": 0 }, "portfolios": { "uri": "/users/61402929/portfolios", "options": [ "GET" ], "total": 0 }, "videos": { "uri": "/users/61402929/videos", "options": [ "GET" ], "total": 1 }, "watchlater": { "uri": "/users/61402929/watchlater", "options": [ "GET" ], "total": 0 }, "shared": { "uri": "/users/61402929/shared/videos", "options": [ "GET" ], "total": 0 }, "pictures": { "uri": "/users/61402929/pictures", "options": [ "GET", "POST" ], "total": 0 }, "watched_videos": { "uri": "/me/watched/videos", "options": [ "GET" ], "total": 0 } } }, "preferences": { "videos": { "privacy": "anybody" } }, "content_filter": [ "language", "drugs", "violence", "nudity", "safe", "unrated" ], "resource_key": "6fe192b4cb782d1341fbf3fb3d0ba04a0295236d" }, "app": null, "status": "available", "resource_key": "cad1f2b7d388491329363a4936f0219fa4dfd18b", "embed_presets": null } ] }
但是我只对字段分页,总计和数据数组的某些字段感兴趣,因此我正在使用以下过滤器
https://api.vimeo.com/users/61402929/videos?access_token=token&fields=paging,data.name,data.description,data.link,data.pictures.sizes.link
但是上述调用的响应是
{ "total": 1, "page": 1, "per_page": 25, "paging": { "next": null, "previous": null, "first": "/users/61402929/videos?access_token=365879********0902890fc1a1&fields=paging%2Cdata.name%2Cdata.description%2Cdata.link%2Cdata.pictures.sizes.link&page=1", "last": "/users/61402929/videos?access_token=365879********0902890fc1a1&fields=paging%2Cdata.name%2Cdata.description%2Cdata.link%2Cdata.pictures.sizes.link&page=1" }, "data": [ [] ]
}
编辑:也是电话的响应
https://api.vimeo.com/users/61402929/videos?access_token=token&fields=paging
是
{ "total": 1, "page": 1, "per_page": 25, "paging": { "next": null, "previous": null, "first": "/users/61402929/videos?access_token=365879*********70902890fc1a1&fields=paging&page=1", "last": "/users/61402929/videos?access_token=365879*********70902890fc1a1&fields=paging&page=1" }, "data": [ [] ]
}
我无法弄清楚为什么未正确处理请求。
有两件事:首先,访问令牌应该在请求的auth标头中传递,而不是您提到的请求uri中传递:https : //developer.vimeo.com/api/authentication#making-requests
对于字段过滤器,该过滤器仅适用于嵌套在下的键data
。对于paging
返回多个项目的请求,始终返回该数组。
因此,您的示例请求应如下所示:
https://api.vimeo.com/users/61402929/videos?fields=name,description,link,pictures.sizes.link
此处更多信息:https : //developer.vimeo.com/api/spec#json-filter
希望这可以帮助!