I'm try to post a file using RestClient
with Ruby on rails, I have try to conver below curl
command:
curl -H 'Authorization: Bearer ACCESS_TOKEN' -F 'file=@FILE_PATH' https://api.com/api
When converting with RestClient
like below:
res = RestClient::Request.new(
method: :post,
url: 'https://api.com/api',
:payload => {
:file => File.new("#{Rails.root}/public/Sample.docx" , 'rb')
},
:headers => {
:Authorization => "Bearer 155c5e5c4feea51b386fdfe204abc60b7f4025fb91988519de869525217b4702",
:content_type => "multipart/form-data"
}
)
res.execute
On this code showing 400 Bad Request
What I'm doing wrong with this code?
Thanks