尝试发送帖子请求以创建'任务'使用Closeio的api。我得到了200,这个任务是'没有发布到网站上。消息正在返回" OK"。我整天都尝试重新格式化params / options。我究竟做错了什么?任何想法?
这是发布请求:
url = 'https://app.close.io/api/v1/task'
params = {
"lead_id" => 'lead_xxxxx....',
"assigned_to" => 'user_yyyyyyyyy.....',
"text" => "This customer has been referred",
"due_date" => Date.today.to_s,
"is_complete" => false
}
response = HTTParty.post( url , {
:body => params.to_json,
:basic_auth => {
:username => [API_KEY],
:password => ' '
},
:headers => {
'Content-Type' => 'application/json'
}
})
响应:
@response=#<Net::HTTPOK 200 OK readbody=true>, @headers={"content-type"=>["application/json; charset=UTF-8"], "date"=>["Sat, 14 Mar 2015 20:19:38 GMT"], "server"=>["ElasticWWW"], "set-cookie"=>["session=; expires=Thu, 01-Jan-1970 00:00:00 GMT; Max-Age=0; Path=/"], "strict-transport-security"=>["max-age=31536000; includeSubDomains"], "vary"=>["Accept"], "x-frame-options"=>["SAMEORIGIN"], "content-length"=>["73861"], "connection"=>["Close"]}>