RestClient不上传多个文件

时间:2016-09-26 09:29:59

标签: ruby-on-rails rest-client

我正在尝试调用外部API并发送附件。以下是卷曲和多重附件的工作示例

  

curl -v -u xxxx@domain.in:password-F   " helpdesk_ticket [附件] [] [资源] = @ / TMP / upload_test_1.txt" -F   " helpdesk_ticket [附件] [] [资源] = @ / TMP / upload_test_2.txt" -F   " helpdesk_ticket [电子邮件] =testemail@domain.in" -F   " helpdesk_ticket [优先] = 1" -F" helpdesk_ticket [source] = 2" -F   " helpdesk_ticket [状态] = 2" -F   " helpdesk_ticket [主题] = TestingSubject" -F   " helpdesk_ticket [描述] = testingcontent" -X POST   URL

通过此卷曲请求,我可以发送和上传多个附件。但是当我使用我的Rails Rest客户端代码执行相同操作时,它不会上传所有附件,而只上传1个附件。

  

RESTClient实现:: Request.execute(URL:   " url",方法:   :post,payload:{" helpdesk_ticket" => {" description" =>" testingcontent",   &#34受试者#34; = GT;" TEstingsubject&#34 ;,   " email" =>" email@domain.in"," priority" => 1," source" => 2,   "状态" => 2,"附件" => [{"资源" =>   File.new(' /tmp/upload_test_1.txt')},{"资源" = GT;   File.new(' /tmp/upload_test_2.txt')}],   " cc_emails" => []," multipart" => true},用户:   " email@domain.in" ;,密码:"密码",超时:   10)

任何建议都将不胜感激。

0 个答案:

没有答案