【问题标题】:Retrieve list of videos from folder in Vimeo Swift 5从 Vimeo Swift 5 中的文件夹中检索视频列表
【发布时间】:2021-06-22 03:48:38
【问题描述】:

我想从我在 Vimeo 上托管的文件夹中查询视频页面。但是,这样做时,我会收到:

Error Domain=com.alamofire.error.serialization.response Code=1011 "Request failed: not found (404)" UserInfo={NSLocalizedDescription=Request failed: not found (404), NSErrorFailingURLKey=https://api.vimeo.com/users/{user-id}/projects/{project-id}/videos, com.alamofire.serialization.response.error.data={length = 51, bytes = 0x7b226572 726f7222 3a225468 65207265 ... 666f756e 642e227d }, ...

我尝试使用表单的不同端点:/users/{user-id}/folders/{folder-id}/videos、/users/{user-id}/projects/{project-id} 和/users/{user-id}/folders/{folder-id},都返回相同的错误。我目前正在创建客户端并以这种方式请求视频:

appConfiguration = AppConfiguration(clientIdentifier: "{id}",
    clientSecret: "{secret}", scopes: [.Public, .Private], keychainService: "")
sessionManager = VimeoSesssionManager.defaultSessionManager(baseUrl: VimeoBaseURL,
    accessToken: "{access_token}", apiVersion: "3.4")
client = VimeoClient(appConfiguration: appConfiguration, sessionManager: sessionManager)

...

var request: Request? = Request<[VIMVideo]>(path: path)
_ = client.request(request) { result in
    switch result {
    case .success(let response):
        ...
    case .failure(let error):
        print("Error retrieving videos: \(error)")
    }
}

但是,我也尝试过使用 VimeoNetworking GitHub 中指定的 AuthenticationController 预先进行身份验证。在 Vimeo 的 API 参考网页上使用文件夹 ID 和用户 ID 进行测试时,一切正常,我可以正常接收视频页面。

所以我只想知道我需要做些什么来检索视频页面,就像我在 Vimeo API 参考网站中所做的那样。

【问题讨论】:

    标签: swift alamofire vimeo-api


    【解决方案1】:

    返回 404 错误的原因是因为我为应用程序创建的访问令牌只有“public”修饰符,但是当我使用 public 创建令牌时, privatevideo_files 修饰符按预期工作!

    【讨论】:

      猜你喜欢
      • 2011-12-02
      • 1970-01-01
      • 1970-01-01
      • 2015-07-22
      • 2021-01-19
      • 2016-06-15
      • 1970-01-01
      • 2015-09-02
      • 1970-01-01
      相关资源
      最近更新 更多