I am trying to call external API and send attachments. Following is working example of curl and multiple attachment
curl -v -u xxxx@domain.in:password -F "helpdesk_ticket[attachments][][resource]=@/tmp/upload_test_1.txt" -F "helpdesk_ticket[attachments][][resource]=@/tmp/upload_test_2.txt" -F "helpdesk_ticket[email]=testemail@domain.in" -F "helpdesk_ticket[priority]=1" -F "helpdesk_ticket[source]=2" -F "helpdesk_ticket[status]=2" -F "helpdesk_ticket[subject]=TestingSubject" -F "helpdesk_ticket[description]=testingcontent" -X POST url
With this curl request i am able to send and upload multiple attachment. But when i am doing same using my Rails Rest client code its not uploading all attachment its uploading only 1 attachment.
RestClient::Request.execute(url: "url", method: :post, payload: {"helpdesk_ticket"=>{"description"=>"testingcontent", "subject"=>"TEstingsubject", "email"=>"email@domain.in", "priority"=>1, "source"=>2, "status"=>2, "attachments"=>[{"resource"=> File.new('/tmp/upload_test_1.txt')},{"resource"=> File.new('/tmp/upload_test_2.txt')}], "cc_emails"=>[], "multipart"=>true}, user: "email@domain.in", password: "password", timeout: 10)
Any suggestion would be appreciated.