I have the following ror code:
app = Publication.find_by_id(params[:background][:publication])
url = 'https://api.parse.com/1/push'
body = { :aps => { "content-available" => 1 }}
body["content-name" => issue] if !issue.empty?
request = Typhoeus::Request.new(url,
method: :post,
body: body.to_json,
headers: { "X-Parse-Application-Id" => app.parse_application_id,
"X-Parse-REST-API-Key" => app.parse_rest_api_key,
"Content-Type" => "application/json"})
request.run
result = JSON.parse(request.response.body).with_indifferent_access
And when I run it I get the following response from Typhoeus:
RESPONSE: {"code"=>115, "error"=>"Missing the push data."}
It's just a simple content-available push that tells the app to download latest issue. Any suggestions as to why this isn't working?
Thanks!!
I figured it out thanks to this post:
Send push notification via REST API in Parse.com {"code":115,"error":"Missing the push data."}
I think for Parse you need to have the content-available inside the data hash. At least that worked for me after adding the where as well.