Copying a curl command with httparty

214 views
Skip to first unread message

vanderkerkoff

unread,
Aug 5, 2015, 4:25:16 PM8/5/15
to HTTParty Gem
Hello everyone

I've built a very basic api that will return a number of unread emails to me.

I can access that api and get the response I want like this with curl

curl http://127.0.0.1:5000/email_id -d "data=00700001" -X GET

I'm now trying to do that same thing in a rails app to get the number back, but I'm doing something wrong.

Here's what I've got so far.

  def oauth_messages_count
    require 'httparty'
    response = HTTParty.get(url,
    :data => {
      :text => "00700001"
    })
    puts response
    return response
  end

I'm obviously doing something wrong, but I can't work out what it is as the logs on the receiving end aren't really telling me anything.

{"message"=>"The browser (or proxy) sent a request that this server could not understand."}

Any help, tips, or links, greatly appreciated.
Reply all
Reply to author
Forward
0 new messages