Questions tagged [rest-client]

REST Client is an open-source HTTP and REST client for Ruby.

REST Client is an open-source HTTP and REST client for Ruby originally created by Adam Wiggins and now maintained by Andy Brody. It was inspired by Sinatra's micro-framework style of specifying actions: get, put, post, delete.

Github

The code repository and issue tracker can be found on github:

https://github.com/rest-client/rest-client

Resources

940 questions
2
votes
1 answer

How to check for nil on an object?

I do the following call to get a Ruby object, which returns data from Spotify's API: spotify_track = RSpotify::AudioFeatures.find('3RmAqYZZjiSyMV40hm6rDL') That returns: #
Shpigford
  • 24,748
  • 58
  • 163
  • 252
2
votes
0 answers

POST transfer progress for large file with RestClient for Rails

I need to POST a large file (several GB) from disk to an external API from my Rails 5.2 app. The file can take up to an hour to transfer. I can POST the file using RestClient, but would like to provide a progress bar to indicate transfer progress. …
KevinU
  • 41
  • 3
2
votes
1 answer

How to convert a CURL request to Ruby Gem HTTPClient

I am trying to convert this CURL request: curl \ -F 'slideshow_spec={ "images_urls": [ "", "", "" ], "duration_ms": 2000, "transition_ms": 200 }' \ -F…
WagnerMatosUK
  • 4,309
  • 7
  • 56
  • 95
2
votes
0 answers

PHP using Guzzle to pass through PDF not working while displaying in browser

(FIXED: See comment below.) I have a website that runs PHP that accesses a REST-service running .NET Core. The REST-API returns a PDF behind OAuth2 security. Now I want the PHP page to pass through the PDF that is in memory. I am doing sth. like…
iquellis
  • 979
  • 1
  • 8
  • 26
2
votes
0 answers

How to use REST Client with a server token

I slowly working my way through the HMRC tutorials and I'm now stuck on the second example: /hello/application https://developer.service.hmrc.gov.uk/api-documentation/docs/tutorials I have registered with the HMRC and been issued a "Server…
Yuppski
  • 137
  • 2
  • 10
2
votes
2 answers

ruby restclient timeout does not work properly, it throws exception after double the defined timeout

Noticed that Ruby RestClient does not follow the given timeout parameter precisely, however it works by doubling the current timeout setting. Has anyone noticed the same? attached a test code example below. As httpbin.org is having max delay 10, we…
jaluke
  • 41
  • 8
2
votes
2 answers

How to rescue RestClient API calls in development mode when no Internet available?

In my Rails app I am making various API calls like this one: class SearchFacebook FALLBACK_STARS = 5.0 def self.call begin url = "https://graph.facebook.com/v2.12/#{FACEBOOK_PAGE_ID}" response = RestClient.get(url, :params =>…
Tintin81
  • 9,821
  • 20
  • 85
  • 178
2
votes
2 answers

Use Yii2 REST client to consume Yii2 REST API

I have created a REST API using the Yii2 documentation. It seems to be working fine as I can use curl like this: curl -i "https://example.com/api/v3/user" \ -H "Accept:application/json" \ -H "Authorization: Bearer…
Mr Goobri
  • 1,449
  • 5
  • 19
  • 42
2
votes
1 answer

REST client that does not need installation

We have a locked down customer environment in which we do not have rights to install anything. In this environment, I need to call some REST services in order to troubleshoot them. In my local development environment, I normally use Postman (Chrome…
kayasa
  • 2,055
  • 8
  • 37
  • 63
2
votes
2 answers

How can I easily parse through a response to rest-client API call?

I am using rest-client to make restful API calls. My response can be either in JSON or XML. How can I easily parse the responses? It is pulling Company and Contact information. Is there a way to treat each XML record as an object, so I can access…
Satchel
  • 16,414
  • 23
  • 106
  • 192
2
votes
1 answer

CORS error while Rest API return 401

I have REST API in Spring as Backend and Angular 2 as Frontend. I call login URL. When response is 201 all its fine, but when I send 401 / 403 I have an error. XMLHttpRequest cannot load http://localhost:8888/emot/login. No…
VANILKA
  • 634
  • 1
  • 13
  • 32
2
votes
2 answers

Spotify Web API: Basic authorization

I need to get an access token from Spotify Web API. Based on this documentation I wrote the following method: def authorize grant = Base64.encode64("#{SPOTIFY_KEY}:#{SPOTIFY_SECRET}") RestClient::Request.execute( method: :post, url:…
Ed de Almeida
  • 3,675
  • 4
  • 25
  • 57
2
votes
3 answers

Getting 401 on post request to mailgun api

Im trying to do a post request to send a email, this is my code: url = "https://api.mailgun.net/v3/MYDOMAIN/messages" params = { :from => "Excited User ", :to => "bruno.brito.ln@gmail.com,…
Bruno Brito
  • 345
  • 4
  • 17
2
votes
1 answer

In ruby with sinatra, How to get I response with get method on rest client?

I use ruby with sinatra and I used rest-client on import for payment. I got token that string typed through post method on specific url: '... /users/getToken'. Using this token, I wanna get payments information with get method on this url: get_url…
2
votes
2 answers

Trying to do a simple GET HTTP request on the Facebook API with rest_client but it's not accepting the url, even though the URL works fine

I'm trying to get the data at this url: https://graph.facebook.com/me?access_token=(my access token) When I go to this address in a browser, it works. But I'm trying to use the rest-client gem in Ruby on Rails like this: url =…
ben
  • 29,229
  • 42
  • 124
  • 179