I'm running a simple Sinatra app where I need to query some data and send a POST via JSON to a webhook URL for processing. I'm not sure how to properly format the records I've retrieved for HTTParty.
The contacts are printing to /account/{account_id}/contacts.json how I want them, they data just isn't being sent successfully.
app.rb
get "/account/:account_id/contacts.json" do
@contacts = Contact.where("sfid = ?", params[:account_id])
HTTParty.post("https://hooks.webapp.com/hooks/catch/387409/1us4j3/",
{
:body => [ @contacts ].to_json,
:headers => { 'Content-Type' => 'application/json', 'Accept' => 'application/json'}
})
@contacts.to_json
end