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
4
votes
3 answers

Create JAX-RS Client Post Request with JSON String as Body

I am writing a REST Client for one of the Vendor REST Service. I use jersey 2.x and JSON-P, below are dependencies I add. org.glassfish.jersey.media
K Raghu
  • 103
  • 1
  • 2
  • 6
4
votes
2 answers

Return Value from async rest template spring

I am creating a async rest call using spring @GetMapping(path = "/testingAsync") public String value() throws ExecutionException, InterruptedException, TimeoutException { AsyncRestTemplate restTemplate = new AsyncRestTemplate(); String…
Rahul
  • 427
  • 3
  • 7
  • 16
4
votes
2 answers

JSON::ParserError: 743: unexpected token in ROR

I am getting this error when try to parse the response from rest_client. JSON::ParserError: 743: unexpected token at '{ require 'rest_client' require 'json' class Kele attr_accessor :data def initialize(u,p) #@values = {email: u,…
leogoesger
  • 3,476
  • 5
  • 33
  • 71
4
votes
3 answers

how to ignore spring security CSRF for specific URL's in spring boot project

how can I ignore CSRF security for specific URL which is like "/workflow/**". Except for this URL, I need both authorization and CSRF security for all the URL's and methods. @Configuration @Order(SecurityProperties.ACCESS_OVERRIDE_ORDER) protected…
Pratap A.K
  • 4,337
  • 11
  • 42
  • 79
4
votes
2 answers

how to pass client credentials in postman?

This curls works fine curl acme:acmesecret@localhost:9999/uaa/oauth/token -d "password=password&username=user&grant_type=password" -H "Accept: application/json" In this curl, acme and acmesecret are client credentials used by application to…
brain storm
  • 30,124
  • 69
  • 225
  • 393
4
votes
2 answers

How to send header and cookies with rest-client gem

In Code I am trying to send both the header and cookies in same request below is the code @result = RestClient.post( 'url', {:billingSourceCode => "code"}, {:cookies => {:session_id => "1234"}}, …
Mukesh
  • 1,257
  • 11
  • 27
4
votes
1 answer

Sending gzip data using restclient or postman

How can I send gzip data as part of body using restclient or postman?. I used apache restclient 3.2.2 also couldn't able to get the response. I have attached images for reference. Basically I have an xml file, want to convert it to gzip first and…
developer
  • 401
  • 1
  • 4
  • 15
4
votes
1 answer

RestClient::MethodNotAllowed: 405 Method Not Allowed GET response

I am performing a GET request in Ruby and not sure why I am sometimes getting the following stack trace. RestClient::MethodNotAllowed: 405 Method Not Allowed [GEM_ROOT]/gems/rest-client-1.6.8/lib/restclient/abstract_response.rb:48:in…
La-comadreja
  • 5,627
  • 11
  • 36
  • 64
4
votes
2 answers

Send and Receive JSON using RestClient and Sinatra

I am trying to send a JSON data to a Sinatra app by RestClient ruby API. At client(client.rb) (using RestClient API) response = RestClient.post 'http://localhost:4567/solve', jdata, :content_type => :json, :accept => :json At server…
Anand
  • 10,310
  • 24
  • 90
  • 135
4
votes
3 answers

Spring controller not accepting application/json

When I am passing application/json parameters from Chrome Rest Client,I am getting 400 bad request error. When I add required=false for @RequestParam, the request is accepted by Controller but the values is Null. @RequestMapping(value = "/add", …
4
votes
1 answer

Consuming a REST API in DropWizard

I'm building an API in java using DropWizard. However, for certain resources I also need to consume other RESTful API's. These other API's do not require any authentication. Can DropWizard be used to consume API's? Or what are some other ways to…
Anthony
  • 33,838
  • 42
  • 169
  • 278
4
votes
1 answer

RestClient logging response

I can log simple request like below from the instructions post here Logging RestClient in a Rails app It logs the request but it does not log the response back from the call. Is there anyway to tell RestClient to log the response as well?
Siva Kandaraj
  • 824
  • 7
  • 15
4
votes
2 answers

passing json data in elasticsearch get request using rest-client ruby gem

How do I execute the below query(given in doc) using rest client. curl -XGET 'http://localhost:9200/twitter/tweet/_search' -d '{ "query" : { "term" : { "user" : "kimchy" } } } ' I tried doing this: q = '{ "query" : { …
mansk
  • 101
  • 2
  • 7
4
votes
4 answers

Correct syntax for get requests with rest-client

Right now I can make a request as follows: user = 'xxx' token = 'xxx' survey_id = 'xxx' response = RestClient.get…
Amit Kumar Gupta
  • 17,184
  • 7
  • 46
  • 64
3
votes
3 answers

Re-factoring a CURL request to Ruby's RestClient

I'm having trouble translating this CURL request into Ruby using RestClient: system("curl --digest -u #{@user}:#{@pass} '#{@endpoint}/#{id}' --form image_file=@'#{path}' -X PUT") I keep getting 400 Bad Request errors. As far as I can tell, the…
user94154
  • 16,176
  • 20
  • 77
  • 116