Questions tagged [httparty]

HTTParty is a Ruby gem written by John Nunemaker focused on the consumption of web services and APIs.

HTTParty is a Ruby gem written by John Nunemaker focused on the consumption of web services and APIs. It boasts a very readable DSL and out-of-the-box support for JSON, HTML and XML.

For more information refer to: It's an HTTParty and Everyone Is Invited!

621 questions
16
votes
1 answer

How can I implement this POST request using HTTParty?

I am having difficulty making a POST request to an API endpoint using Ruby's HTTParty library. The API I'm interacting with is the Gittip API and their endpoint requires authentication. I have been able to successfully make an authenticated GET…
John K. Ferguson
  • 641
  • 2
  • 8
  • 15
15
votes
1 answer

Using rails to consume web services/apis

I'm new to the rails world and am trying to build a app to simply allow me to search things on Amazon and such sites based on the users input. I've done a little reasearch and it seems the httparty gem is a good place to start? The documents ive…
Keva161
  • 2,623
  • 9
  • 44
  • 68
13
votes
3 answers

Capture specific request with HTTParty

I would like to capture the full request (raw_request -- what went over the wire) for a given action without using a proxy. I am aware of the debug_output method on the Class, and that might be part of the solution. But unclear on how to set it on…
Jonathan
  • 16,077
  • 12
  • 67
  • 106
13
votes
2 answers

Why do I get the error uninitialized constant Stuff::HTTParty?

I have the HTTParty gem on my system and I can use it from within rails. Now I want to use it standalone. I am trying: class Stuff include HTTParty def self.y HTTParty.get('http://www.google.com') end end Stuff.y but I get $ ruby…
Michael Durrant
  • 93,410
  • 97
  • 333
  • 497
12
votes
2 answers

HTTParty parsed_response returns a String instead of Hash

HTTParty's parsed_response method returns a Hash if you get a response code 200 but otherwise it will return a String regardless if the webserver returns a XML response. HTTParty.get(post_url).parsed_response.class # Depends on response code Amazon…
Chris Cummings
  • 2,007
  • 5
  • 25
  • 39
12
votes
1 answer

How can I post with an instance variable and HTTParty to an API that uses OAuth2

I can get information from an Oauth2 API by: token = "Token I get from authenticating my App" auth = "Bearer " + token user = HTTParty.get("API Website", :headers => { "Authorization" => auth}) How would I post to that API content generated in my…
shicholas
  • 6,123
  • 3
  • 27
  • 38
10
votes
1 answer

Errno::ECONNREFUSED (Failed to open TCP connection to :80 (Connection refused - connect(2) for nil port 80))

I'm trying to use the library HTTParty, but whenever I run the code below I receive an error. Code: require 'httparty' response = HTTParty.get('http://example.com') When I run the code I receive the error: Errno::ECONNREFUSED (Failed to open TCP…
Practical1
  • 789
  • 1
  • 8
  • 26
10
votes
3 answers

OAuth and HTTParty

Is it possible to use OAuth with HTTParty? I'm trying to do this API call, but, contradictory to the documentation, it needs authentication. Before you say "Use a Twitter-specific Gem", hear me out--I've tried. I've tried twitter, grackle, and…
Ethan Turkeltaub
  • 2,931
  • 8
  • 30
  • 45
9
votes
2 answers

How to test HTTParty API call with Ruby and RSpec

I am using the HTTParty gem to make a call to the GitHub API to access a list of user's repos. It is a very simple application using Sinatra that displays a user's favourite programming language based on the most common language that appears in…
dwalsh91
  • 95
  • 1
  • 2
  • 5
9
votes
2 answers

HTTParty options parameter not functioning properly

I'm setting up an application which can make LastFM API Requests. These are simple get requests and I'm using the HTTParty gem. My function is as follows: def get_albums self.class.base_uri "http://ws.audioscrobbler.com/2.0/" options = { …
Biketire
  • 2,019
  • 1
  • 23
  • 41
8
votes
2 answers

Handling Net::ReadTimeout error in HTTParty

I am using httparty (0.13.1) gem. I am making series of API calls using httparty. Some of my initial API calls succeeded, but the later calls fail consecutively. I have added a timeout of 180 seconds. I searched google but I can not find any…
Sam
  • 5,040
  • 12
  • 43
  • 95
7
votes
3 answers

Send multiple files using HTTParty

Here is the code which is working using Net::HTTP::Post request = Net::HTTP::Post.new(url) ... form_data = [ ['attachments[]', File.open('file1.txt')], ['attachments[]', File.open('file2.txt')] ] request.set_form form_data,…
Rajkaran Mishra
  • 4,532
  • 2
  • 36
  • 61
7
votes
4 answers

how to upload video file with httparty

hi I have seen httparty but I don't have a idea to how to implement there are many example of model file but which paramater can be use for upload the video file
hardik9045
  • 499
  • 1
  • 6
  • 17
7
votes
4 answers

How to verify server SSL certificate?

I am a newbie on SSL concept, I am trying to connect to API which has x509 mutual auth using HTTParty. I got client cert, client key and server cert (all are pem files). I got it working with client cert and key and with verify: false. Now next…
pramodtech
  • 6,300
  • 18
  • 72
  • 111
7
votes
2 answers

How can I increase timeout for HTTParty post method in rails?

I have a method in rails to send post requests to a third party API. The code looks similar to the following: data = HTTParty.post("url", :headers=> {'Content-Type' => 'application/json'}, :body=> { update => true, first_name => "name" } ) With…
Gopi Raju
  • 219
  • 3
  • 13
1
2
3
41 42