I am trying to upload file with'rest-client' gems. I have tried but no luck. Here the code I tried so far.
content_type = MIME::Types.type_for('/home/vagrant/mukesh.txt').first.content_type
headers = {
"Authorization"=> "Bearer ",
"Content-Type"=> content_type
}
payload = {
"attributes"=> {"name"=>"mukesh.txt", "parent"=>{"id"=>"0"}},
"file"=> File.new('/home/vagrant/mukesh.txt', 'rb'),
"multipart"=> true
}
response = RestClient::Request.execute(:method=> :post,:url=>"https://upload.box.com/api/2.0/files/content",:payload=>payload , :headers=> headers)
It is giving, 405 method not allowed errors. Can somebody help me?