2013-04-08 58 views
2

我想給這樣一個完整的要求:如何使用發送完整的POST請求的Net :: HTTP(Rails)的

POST /2012-09-25/jobs HTTP/1.1 
Content-Type: application/json; charset=UTF-8 
Accept: */* 
Host: elastictranscoder.amazonaws.com:443 
x-amz-date: Mon, 14 Jan 2013 17:49:52 GMT 
Authorization: AWS4-HMAC-SHA256 
      Credential=AccessKeyID/request-date/Elastic Transcoder endpoint/ets/aws4_request, 
      SignedHeaders=host;x-amz-date;x-amz-target, 
      Signature=calculated-signature 
Content-Length: number of characters in the JSON string 
{ 
"Input":{ 
    "Key":"AAAA", 
    "FrameRate":"auto", 
    "Resolution":"auto", 
    "AspectRatio":"auto", 
    "Interlaced":"auto", 
    "Container":"auto" 
}, 
"Output":{ 
    "Key":"BBBB", 
    "ThumbnailPattern":"pattern", 
    "Rotate":"auto", 
    "PresetId":"12345" 
}, 
"PipelineId":"987654" 
} 

如何在Rails的Net::HTTP做到嗎?

回答

3

查閱這些,POST表單請求,文件上傳 - 輸入類型= 「文件」 風格

http://www.rubyinside.com/nethttp-cheat-sheet-2940.html

https://github.com/augustl/net-http-cheat-sheet

+0

嗨艾哈邁德,謝謝,我 – Khalid 2013-04-08 12:35:06

+0

請點擊此鏈接https://開頭的github .com/augustl/net-http-cheat-sheet/blob/master/post_form.rb然後我得到錯誤「getaddrinfo:名稱或服務未知」你知道它是什麼嗎? – Khalid 2013-04-08 12:35:55