"无效状态" Vimeo API删除后

时间:2016-04-14 08:25:53

标签: php curl vimeo dropzone.js vimeo-api

希望有人可以提供帮助..我使用jQuery dropzone.js上传视频,我可以上传视频,但我无法完成"该过程使视频始终处于处理/上传状态。我根据Vimeo API文档执行了正确的过程。以下是一些标题/回复,如果它们有帮助,我已用xxxx替换了一些值:

上传请求标题:

PUT /upload?ticket_id=xxxx&video_file_id=514311645&signature=acd2a6c4ba8c147651604793b081e053&v6=1 HTTP/1.1
Host: 1511923755.cloud.vimeo.com
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Firefox/45.0 FirePHP/0.7.4
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate, br
Content-Type: video/mp4
Referer: http://local.xxxx.co.uk/vimeo
Content-Length: 29158540
Origin: http://local.xxxx.co.uk
x-insight: activate
Connection: keep-alive

上传响应标题:

HTTP/1.1 200 OK
Server: Vimeo/1.0
Content-Type: text/plain
Access-Control-Allow-Origin: *
Timing-Allow-Origin: *
Access-Control-Expose-Headers: Range
Access-Control-Allow-Headers: Content-Type, Content-Range,  X-Requested-With
X-Requested-With: XMLHttpRequest
Access-Control-Allow-Methods: POST, PUT, GET, OPTIONS
Content-Length: 0
Connection: close
Date: Thu, 14 Apr 2016 08:05:19 GMT
X-Backend-Server: kopiluwak

上传回复:

<pre>Array
(
    [body] => 
    [status] => 308
    [headers] => Array
        (
            [] => 
            [HTTP/1.1 308 Resume Incomplete] => 
            [Server] => Vimeo/1.0
            [Content-Type] => text/plain
            [Access-Control-Allow-Origin] => *
            [Timing-Allow-Origin] => *
            [Access-Control-Expose-Headers] => Range
            [Access-Control-Allow-Headers] => Content-Type, Content-Range,  X-Requested-With
            [X-Requested-With] => XMLHttpRequest
            [Access-Control-Allow-Methods] => POST, PUT, GET, OPTIONS
            [Content-Length] => 0
            [Connection] => close
            [Range] => bytes=0-29158540
            [Date] => Thu, 14 Apr 2016 08
            [X-Backend-Server] => kopiluwak
        )

)
</pre>

CURL DELETE:

<pre>Array
(
    [47] => 1
    [10036] => DELETE
    [10015] => 
    [10023] => Array
        (
            [0] => Accept: application/vnd.vimeo.*+json; version=3.2
            [1] => User-Agent: vimeo.php 1.0; (http://developer.vimeo.com/api/docs)
            [2] => Authorization: Bearer xxxx
        )

)
</pre>

来自DELETE的回复:

<pre>Array
(
    [body] => Array
        (
            [error] => Invalid state
        )

    [status] => 500
    [headers] => Array
        (
            [Server] => nginx
            [Content-Type] => application/vnd.vimeo.error+json
            [Cache-Control] => no-cache, max-age=315360000
            [Strict-Transport-Security] => max-age=15120000; includeSubDomains; preload
            [Expires] => Sun, 12 Apr 2026 08
            [Accept-Ranges] => bytes
            [Via] => 1.1 varnish
            [Fastly-Debug-Digest] => 771e16bfeec90f734db73b1b0ee67af1dae1f86d0e6c56d4585eb9958a1684b7

            [Content-Length] => 25
            [Date] => Thu, 14 Apr 2016 08
            [Connection] => keep-alive
            [X-Served-By] => cache-iad2138-IAD, cache-lcy1126-LCY
            [X-Cache] => MISS, MISS
            [X-Cache-Hits] => 0, 0
            [X-Timer] => S1460621123.195320,VS0,VE593
            [Vary] => Accept,Vimeo-Client-Id,Accept-Encoding
        )

)
</pre>

1 个答案:

答案 0 :(得分:0)

我刚刚在Vimeo论坛上回复了同样的问题,并且我读了另一个SO帖子 - 我有同样的问题,我只是在这里发布,因为在这个特定的线程上似乎没有解决方案。 / p>

此外,关于您的帖子 - 您的帖子中没有提供大量信息。您的删除请求并非所有要求 - 假设您创建了有效的票证请求,正确上传,然后尝试了您发布的del请求。

您的回复与我的回复相似 - 如果您的上传脚本试图在您的后端已经有一张票后获得一张票,则会在我的代码中弹出此问题。

Vimeo帖子: https://vimeo.com/forums/api/topic:278394

我的解决方案: 我解决了我的问题版本 - 我认为Vimeo最近纠正了他们的API上的一些东西,因为我的代码没有错误,然后最近突然出现了一个。我敢打赌,他们在API网关上添加了速率限制,或者可能覆盖现有的请求来清理旧请求......

无论如何,这是我的修复:

要通过“Resumable HTTP PUT uploads”(developer.vimeo.com/api/upload/videos)完成视频上传,有5个步骤。

除了通过我的PHP后端上传外,我做的一切都是。我通过PHP请求票证,不通过我修改的JS前端(github.com/websemantics/vimeo-upload)暴露一些秘密信息,但我没有通过JS代码正确编辑票证请求,所以当前的错误可能是在第二个无效请求(即通过PHP覆盖或限制我的初始有效请求)。一旦我正确绕过JS“上传”功能并直接跳到JS“sendFile_”,上传工作再次正常。

希望能帮到那里的人!