无效参数 "path"=>"/" (HTTPParty Ruby)
Invalid Param "path"=>"/" (HTTParty Ruby)
我想在我的自动化上做一个 httparty post,但我收到一个错误,相信我,我试图在互联网上找到一个解决方案,但没有找到。
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
我得到的错误是:
[1] pry(#<LimitValidatorClient>)> special_test
=> {"_embedded"=>{"errors"=>[{"logref"=>"INVALID", "message"=>"Invalid params", "path"=>"/"}]}}
我认为的错误:
"message"=>"Invalid params", "path"=>"/"
(so, the "/" in the url)
我尝试了什么:
我已经尝试将 url 设为全局变量并使用 #{url} 替换 @special_test_url,我尝试删除 to_str 和直接用“”地址,我试过去掉body和header,已经试过在special_limits后面加一个“/”,但是没有,问题是[=33中的”/” =],但我不知道为什么。
感谢您的宝贵时间。我知道这可能是一个愚蠢的问题,但我没有任何线索。
谢谢 Dave 和 Yule,他们都是对的。 url 是正确的,这是 API 的回应。方法没问题。
我会在 API 中尝试新的东西来解决这个问题。
我想在我的自动化上做一个 httparty post,但我收到一个错误,相信我,我试图在互联网上找到一个解决方案,但没有找到。
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
我得到的错误是:
[1] pry(#<LimitValidatorClient>)> special_test
=> {"_embedded"=>{"errors"=>[{"logref"=>"INVALID", "message"=>"Invalid params", "path"=>"/"}]}}
我认为的错误:
"message"=>"Invalid params", "path"=>"/"
(so, the "/" in the url)
我尝试了什么:
我已经尝试将 url 设为全局变量并使用 #{url} 替换 @special_test_url,我尝试删除 to_str 和直接用“”地址,我试过去掉body和header,已经试过在special_limits后面加一个“/”,但是没有,问题是[=33中的”/” =],但我不知道为什么。
感谢您的宝贵时间。我知道这可能是一个愚蠢的问题,但我没有任何线索。
谢谢 Dave 和 Yule,他们都是对的。 url 是正确的,这是 API 的回应。方法没问题。
我会在 API 中尝试新的东西来解决这个问题。