user10707598
user10707598

Reputation: 19

How to properly format this RestClient post with Authorization Header

RestClient.post "https://example.com`", {"id"=>"","name"=>params[:company_name],"frate"=>"0.005"}.to_json,{:Authorization => bearertoken},{content_type: :json, accept: :json}

I receive the following error:

ArgumentError (wrong number of arguments (given 4, expected 2..3)):

Upvotes: 0

Views: 63

Answers (1)

ErvalhouS
ErvalhouS

Reputation: 4216

You have passed the Authorization header correctly, but the other two headers you separeted when they should be together. Try like this:

RestClient.post "https://example.com`", {"id"=>"","name"=>params[:company_name],"frate"=>"0.005"}.to_json,{:Authorization => bearertoken ,content_type: :json, accept: :json}

Upvotes: 1

Related Questions