0
我必須在httparty發送POST請求並得到響應 的json PARAMS是如何構建JSON PARAMS在Httparty
{
"webhook": {
"topic": "shop/update",
"address": "http://2350d6c0.ngrok.io/shopify_stores/update_shop_info",
"format": "json"
}
}
,我使用httparty PARAMS作爲
begin
response = HTTParty.post("#{url}",
{
:body => [
{
"webhook" => {
"topic" => "shop\/update",
"address" => "http:\/\/15ec3a12.ngrok.io\/shopify_stores\/update_shop_info", #place your url here
"format" => "json"
}
}
].to_json,
:headers => { 'Content-Type' => 'application/json', 'Accept' => 'application/json'}
})
byebug
rescue HTTParty::Error
end
但repsonse是
所需參數缺失或無效
好的。在「private」部分下,控制器中是否有某個部分表示「def something_params」?如果是這樣,你能把這個問題放在你的問題上嗎? –
我不使用它們只是發送一個請求到服務器並保存響應 –