Search code examples
rubypostrest-client

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 ?


Solution

  • 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