3

I am trying to get the following curl command (which works) replicated in some Ruby code, however the 'Customer-Id' header part seems to not get sent/picked up by the API.

The curl command is: curl -u ‘me@mydomain.com’ -H ‘Customer-Id: 243’ https://192.168.50.50/api/customers

which returns info on that customer. However in Ruby, the following is not working:

auth = {
  username: “me@mydomain.com”,
  password: "#{pass}"
}

@result = HTTParty.get("https://192.168.50.50/api/customers",:basic_auth => auth, :headers => { ‘Customer-Id: 243’ } ).parsed_response
puts @result

If anyone has any ideas what I am doing wrong here, it would be appreciated!

DerRabe
  • 313
  • 1
  • 3
  • 6

1 Answers1

0

Looking at your code, there is an error:

:headers => { ‘Customer-Id: 243’ }

Try this way:

:headers => {'Customer-Id' => 243}
TieDad
  • 9,143
  • 5
  • 32
  • 58