弹性转码器AWS从Parse.com创建作业CloudCode Javascript http请求

时间:2015-06-09 14:58:55

标签: javascript amazon-web-services parse-platform httprequest amazon-elastic-transcoder

我在AWS Elastic Transcoder上创建了一个管道,我正在尝试使用它的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);
        }
 
    });


});




我可以看到我的网址可能是错误的,但那是因为我无法通过此处的文档告诉我应该向哪个网址发送请求: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":{}}

任何关于如何做的反馈都会很棒。

感谢。

1 个答案:

答案 0 :(得分:0)

这里有几件事: