I understand how to make an http request using basic authentication with Ruby's rest-client
response = RestClient::Request.new(:method => :get, :url => @base_url + path, :user => @sid, :password => @token).execute
and how to post a file as multipart form data
RestClient.post '/data', :myfile => File.new("/path/to/image.jpg", 'rb')
but I can't seem to figure out how to combine the two in order to post a file to a server which requires basic authentication. Does anyone know what is the best way to create this request?
Here is an example with a file and some json data:
The newest best way may be that: the link is enter link description here
How about using a
RestClient::Payload
withRestClient::Request
... For an example:RestClient API seems to have changed. Here's the latest way to upload a file using basic auth: