“无效状态”后Vimeo API删除 [英] "Invalid State" after Vimeo API delete

查看:275
本文介绍了“无效状态”后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
原产地:http://local.xxxx.co.uk
x-insight:activate
连接:keep-alive

上传响应标头:

  HTTP / 1.1 200 OK 
服务器: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 
b $ b [body] =>
[status] => 308
[headers] =>数组

[] =>
[HTTP / 1.1 308 Resume Incomplete] =>
[Server] => Vimeo / 1.0
[类型] => text / plain
[Access-Control-Allow-Origin] => *
[Timing-Allow-Origin] => *
[Access- -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] =& -Agent:vimeo.php 1.0;(http://developer.vimeo.com/api/docs)
[2] =>授权:Bearer xxxx



< / pre>

来自DELETE的回应:

 < pre> Array 

[body] => Array

[error] =>无效状态


[status] => 500
[headers] => Array

[Server] => nginx
[Content-Type ] => application / vnd.vimeo.error + json
[Cache-Control] => no-cache,max-age = 315360000
[Strict-Transport-Security] =& 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] =>接受,Vimeo-Client-Id,接受编码



< / pre>


解决方案

我刚刚回复了同一问题在Vimeo论坛和另一个SO线程我读 - 我有同样的问题,我只是张贴在这里,因为似乎没有解决这个特定的线程。



此外,关于您的帖子 - 您的帖子中没有提供很多信息。您的删除请求不是必需的 - 假设您创建了有效的票据请求,正确上传,THEN尝试了您发布的DEL请求。



您的回复是类似于我的下面 - 如果你的上传脚本试图得到一个票后,你已经有一个在你的后端,这个问题将弹出,因为它在我的代码。



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



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



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



要通过可恢复的HTTP PUT上传完成视频上传( developer.vimeo.com/api/upload/videos ),有5个步骤。



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



希望帮助某人在那里! >

Hopefully someone can help.. I'm using jQuery dropzone.js to upload the video and I can upload videos fine, but I can't "complete" the process so the videos always remain in a processing/uploading state. I'm performing the correct procedures according to the Vimeo API docs. Here are some headers/responses if they help, I've replaced some values with xxxx:

Upload request headers:

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

Upload Response headers:

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

Upload response:

<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>

Response from 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>

解决方案

I just replied to the same issue over on the Vimeo forum, and another SO thread I read - I had the same issue and am simply posting it here as there didn't seem to be a solution on this particular thread.

Also, regarding your post - there's not a lot of information provided in your post. Your delete request is not all that's required - the assumption would be that you created a valid ticket request, uploaded properly, THEN tried the del request you posted.

Your response is similar to mine below - if your upload script tried to get a ticket AFTER you already got one on your backend, this issue would popup as it did in my code.

Vimeo post: https://vimeo.com/forums/api/topic:278394

My solution: I solved my version of the issue - I think Vimeo corrected some stuff on their API recently because my code did not have a bug and then suddenly one appeared recently. I would bet they added rate limiting on their API gateway or potentially overwriting existing requests to clean up old requests...

Anyhow, here is my fix:

In order to complete a video upload via "Resumable HTTP PUT uploads" (developer.vimeo.com/api/upload/videos), there are 5 steps.

I do everything but the upload through my PHP backend. I was requesting a ticket through PHP as to not expose some secret info through my modified JS frontend (github.com/websemantics/vimeo-upload) but I had not edited out the ticket request properly through the JS code, so the current bug was probably being triggered on that second invalid request (i.e. overwriting or rate limiting my initial valid request through PHP). Once I bypassed the JS "upload" function properly and jumped right to JS "sendFile_", the upload works properly again.

Hope that helps somebody out there!

这篇关于“无效状态”后Vimeo API删除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆