我在AWS弹性转码器上创建了一个管道,我正在尝试使用其API来创建工作.这就是我在做什么
Parse.Cloud.define("createJobOnElastic",function(request,response){ Parse.Cloud.httpRequest({ method: 'POST',headers: { 'Content-Type': 'application/json; charset=UTF-8','Accept': '*/*','Host': 'elastictranscoder.us-east-1.amazonaws.com:443','Content-Length': '300',"x-amz-date": new Date().getTime() },url: 'https://aws.elastictranscoder.us-east-1.amazonaws.com:443/2012-09-25/jobs',body:{ "Input":{ "Key":"fullViewLq1teqJ1Ym-nHGwcJtRuL-1433857991.895335.mp4","FrameRate":"auto","Resolution":"auto","AspectRatio":"auto","Interlaced":"auto","Container":"mp4" },"OutputKeyPrefix":"compressed/","Outputs":[ { "Key":"fullViewLq1teqJ1Ym-nHGwcJtRuL-1433857991.895335.mp4","Rotate":"0","PresetId":"1351620000001-000030" } ],"PipelineId":"xxxxxxxxx-xxxx" },success: function(httpResponse) { // console.log(httpResponse); alert("Worked TRANCODER"); response.success(); },error: function(httpResponse) { // console.error(httpResponse); alert("Did not work TRANSCODER"); response.error(httpResponse); } }); });
我可以看到我的url可能是错误的,但是这是因为我不能真正地告诉我应该从他们的文档发送请求到哪个url:http://docs.aws.amazon.com/elastictranscoder/latest/developerguide/create-job.html#create-job-description
这是我得到的回应:
{"uuid":"7dd5e323-167f-fe75-ca64-0adeeebad099","status":0,"headers":{"Connection":"keep-alive","Content-Language":"en","Content-Length":"3871","Content-Type":"text/html","Date":"Tue,09 Jun 2015 14:44:23 GMT","Mime-Version":"1.0","Server":"squid/3.1.19","Vary":"Accept-Language","X-Squid-Error":"ERR_DNS_FAIL 0"},"text":"Request Failed; 56-111 Failure when receiving data from the peer; Connection refused","buffer":[],"cookies":{}}
关于如何做的任何反馈将是巨大的.
谢谢.
解决方法
几件事情在这里:
>您不能只是在没有签署您的请求的情况下发布到弹性代码转换器端点.所有AWS服务都要求您签署请求.见:http://docs.aws.amazon.com/general/latest/gr/signing_aws_api_requests.html>你可能不应该在头文件中指定Host和Content-Length.>输出键与输入键相同有点混乱>您应该可以显示管道是如何创建的完整性.