Graham Slick
Graham Slick

Reputation: 6870

Pass parameters in RestClient post request

I want to send parameters with a POST request using the RestClient gem (but I don't want to pass the params as JSON).

In a GET request, I would have:

url = "http://example.com?param1=foo&param2=bar"
RestClient.get url 

How can I pass the same params but in a POST request without passing a JSON ?

Upvotes: 2

Views: 4070

Answers (1)

Ravi Shankar Bharti
Ravi Shankar Bharti

Reputation: 9268

Read ReadMe file of Rest-client git, it has lots of examples showing different types of request.

For your answer, try :

url = "http://example.com"
RestClient.post url,:param1=>foo, :param2=>bar

Upvotes: 2

Related Questions