Welcome to rest.client list.


Emiliano Heyns <Emiliano.Heyns@...>
 

I'm trying to upload a file to the crowdin translation site. The following curl call does the job:


I'm using the following with rest_client, but I'm getting a "bad request" error:

  :key => 'blablabla',
  :files => {:"Redmine Backlogs.yml" => File.new('en.yml')}
  )

what is the correct way to send files[] type params?


Archiloque <code@...>
 

Hi,

RestClient doesn't detect files in arrays (I'll fix it), could you try adding :multipart => true to the params ?

A.

Le 15 août 2011 à 00:50, Emiliano Heyns a écrit :

I'm trying to upload a file to the crowdin translation site. The following curl call does the job:


I'm using the following with rest_client, but I'm getting a "bad request" error:

  :key => 'blablabla',
  :files => {:"Redmine Backlogs.yml" => File.new('en.yml')}
  )

what is the correct way to send files[] type params?


Emiliano Heyns <Emiliano.Heyns@...>
 

Same thing, "Bad Request".


On Mon, Aug 15, 2011 at 09:53, Archiloque <code@...> wrote:
Hi,

RestClient doesn't detect files in arrays (I'll fix it), could you try adding :multipart => true to the params ?

A.

Le 15 août 2011 à 00:50, Emiliano Heyns a écrit :

I'm trying to upload a file to the crowdin translation site. The following curl call does the job:


I'm using the following with rest_client, but I'm getting a "bad request" error:

  :key => 'blablabla',
  :files => {:"Redmine Backlogs.yml" => File.new('en.yml')}
  )

what is the correct way to send files[] type params?



Archiloque <code@...>
 

Hi,

no idea: when trying locally the log seems ok, could you try to check with their support to see if they see anything, or perhaps anybody else on the list has an idea ?

A.


Le 15 août 2011 à 17:34, Emiliano Heyns a écrit :

Same thing, "Bad Request".

On Mon, Aug 15, 2011 at 09:53, Archiloque <code@...> wrote:
Hi,

RestClient doesn't detect files in arrays (I'll fix it), could you try adding :multipart => true to the params ?

A.

Le 15 août 2011 à 00:50, Emiliano Heyns a écrit :

I'm trying to upload a file to the crowdin translation site. The following curl call does the job:


I'm using the following with rest_client, but I'm getting a "bad request" error:

  :key => 'blablabla',
  :files => {:"Redmine Backlogs.yml" => File.new('en.yml')}
  )

what is the correct way to send files[] type params?




Emiliano Heyns <Emiliano.Heyns@...>
 

I'll go check. To be sure, the code below ought to do the trick?

project = 'redmine-backlogs'
r = RestClient.post("#{root}/update-file",
  :key => key,
  :json => 'json',
  :files => {:"Redmine Backlogs.yml" => File.new('/home/hnse/redmine/redmine_backlogs/config/locales/en.yml')},
  :params => {:multipart => true}
  )

Thanks,
Emile


On Mon, Aug 15, 2011 at 19:37, Archiloque <code@...> wrote:
Hi,

no idea: when trying locally the log seems ok, could you try to check with their support to see if they see anything, or perhaps anybody else on the list has an idea ?

A.


Le 15 août 2011 à 17:34, Emiliano Heyns a écrit :

Same thing, "Bad Request".

On Mon, Aug 15, 2011 at 09:53, Archiloque <code@...> wrote:
Hi,

RestClient doesn't detect files in arrays (I'll fix it), could you try adding :multipart => true to the params ?

A.

Le 15 août 2011 à 00:50, Emiliano Heyns a écrit :

I'm trying to upload a file to the crowdin translation site. The following curl call does the job:


I'm using the following with rest_client, but I'm getting a "bad request" error:

  :key => 'blablabla',
  :files => {:"Redmine Backlogs.yml" => File.new('en.yml')}
  )

what is the correct way to send files[] type params?





Archiloque <code@...>
 

Sorry I was unclear, just add multipart as a parameter in the request:

project = 'redmine-backlogs'
r = RestClient.post("#{root}/update-file",
  :key => key,
  :json => 'json',
  :files => {:"Redmine Backlogs.yml" => File.new('/home/hnse/redmine/redmine_backlogs/config/locales/en.yml')},
  :multipart => true # that's it
  )

or else you can pull the latest version of the code from the repo on the "next" branch, I've improved the file detection this afternoon

A.

Le 15 août 2011 à 19:52, Emiliano Heyns a écrit :

I'll go check. To be sure, the code below ought to do the trick?

project = 'redmine-backlogs'
r = RestClient.post("#{root}/update-file",
  :key => key,
  :json => 'json',
  :files => {:"Redmine Backlogs.yml" => File.new('/home/hnse/redmine/redmine_backlogs/config/locales/en.yml')},
  :params => {:multipart => true}
  )

Thanks,
Emile

On Mon, Aug 15, 2011 at 19:37, Archiloque <code@...> wrote:
Hi,

no idea: when trying locally the log seems ok, could you try to check with their support to see if they see anything, or perhaps anybody else on the list has an idea ?

A.


Le 15 août 2011 à 17:34, Emiliano Heyns a écrit :

Same thing, "Bad Request".

On Mon, Aug 15, 2011 at 09:53, Archiloque <code@...> wrote:
Hi,

RestClient doesn't detect files in arrays (I'll fix it), could you try adding :multipart => true to the params ?

A.

Le 15 août 2011 à 00:50, Emiliano Heyns a écrit :

I'm trying to upload a file to the crowdin translation site. The following curl call does the job:


I'm using the following with rest_client, but I'm getting a "bad request" error:

  :key => 'blablabla',
  :files => {:"Redmine Backlogs.yml" => File.new('en.yml')}
  )

what is the correct way to send files[] type params?






Emiliano Heyns <Emiliano.Heyns@...>
 

OK, same problem, I've contacted their support. Thanks!


On Mon, Aug 15, 2011 at 21:18, Archiloque <code@...> wrote:
Sorry I was unclear, just add multipart as a parameter in the request:

project = 'redmine-backlogs'
r = RestClient.post("#{root}/update-file",
  :key => key,
  :json => 'json',
  :files => {:"Redmine Backlogs.yml" => File.new('/home/hnse/redmine/redmine_backlogs/config/locales/en.yml')},
  :multipart => true # that's it
  )

or else you can pull the latest version of the code from the repo on the "next" branch, I've improved the file detection this afternoon

A.

Le 15 août 2011 à 19:52, Emiliano Heyns a écrit :

I'll go check. To be sure, the code below ought to do the trick?

project = 'redmine-backlogs'
r = RestClient.post("#{root}/update-file",
  :key => key,
  :json => 'json',
  :files => {:"Redmine Backlogs.yml" => File.new('/home/hnse/redmine/redmine_backlogs/config/locales/en.yml')},
  :params => {:multipart => true}
  )

Thanks,
Emile

On Mon, Aug 15, 2011 at 19:37, Archiloque <code@...> wrote:
Hi,

no idea: when trying locally the log seems ok, could you try to check with their support to see if they see anything, or perhaps anybody else on the list has an idea ?

A.


Le 15 août 2011 à 17:34, Emiliano Heyns a écrit :

Same thing, "Bad Request".

On Mon, Aug 15, 2011 at 09:53, Archiloque <code@...> wrote:
Hi,

RestClient doesn't detect files in arrays (I'll fix it), could you try adding :multipart => true to the params ?

A.

Le 15 août 2011 à 00:50, Emiliano Heyns a écrit :

I'm trying to upload a file to the crowdin translation site. The following curl call does the job:


I'm using the following with rest_client, but I'm getting a "bad request" error:

  :key => 'blablabla',
  :files => {:"Redmine Backlogs.yml" => File.new('en.yml')}
  )

what is the correct way to send files[] type params?