Search code examples
rubyhttparty

Invalid Param "path"=>"/" (HTTParty Ruby)


I'm trying to make a httparty post on my automation, but I get a error and, believe me, I tried to find in internet a solution, but don't find it.

8:   @special_test_url = 'http://192.168.1.1/api/v1/special_limits'
9:
10:   special_test = HTTParty.post(@special_test_url.to_str,
11:     {
12:     :body => [ { "documents": "#{document}", "limit": 0, "main_account_id": 3} ].to_json,
13:     :headers => {  'Content-Type': 'application/json', 'Accept': 'application/json'}     
14:     })
15:
 => 16:   binding.pry
    17:   
    18: end

The error I get is:

[1] pry(#<LimitValidatorClient>)> special_test
=> {"_embedded"=>{"errors"=>[{"logref"=>"INVALID", "message"=>"Invalid params", "path"=>"/"}]}}

What I think is the error:

"message"=>"Invalid params", "path"=>"/"
(so, the "/" in the url)

What I tried:

I already tried to made the url a global variable and use #{url} to replace the @special_test_url, I tried to remove the to_str and use the address directly with " ", and I tried to remove the body and header, and already tried to put a "/" after the special_limits, but nothing, the problem is the "/" in the URL, but I don't know why.

Thanks for ur time. I know this can be a stupid question, but I don't have any clue.


Solution

  • Thanks Dave and Yule, both are right. The url was right and this is a API response. Nothing wrong with the method.

    I'll try new things in the API to solve this.