Skip to content

Getting error PUSH ERRORXMLHttpRequest failed: "Unable to connect to the Parse API" when sending push through Curl #1337

Closed
@HemanParbhakar

Description

@HemanParbhakar

Check out this issue for an ideal bug report. The closer your issue report is to that one, the more likely we are to be able to help, and the more likely we will be to fix the issue quickly!

For implementation related questions or technical support, please refer to the Stack Overflow and Server Fault communities.

Make sure these boxes are checked before submitting your issue -- thanks for reporting issues back to Parse Server!

Environment Setup

Steps to reproduce

Logs/Trace

curl -X POST -H "X-Parse-Application-Id: myqappid" -H"X-Parse-Master-Key:mymasterkey" -H "Content-Type: application/json" -d '{"action": "SEND_PUSH", "message": "hello", "customData": "My message"}' http://ipadress:1337/parse/functions/pushChannelTest

Cloud.js__)))_///////

Parse.Cloud.define('pushChannelTest', function(request, response) {

// request has 2 parameters: params passed by the client and the authorized user
var params = request.params;
var user = request.user;

// extract out the channel to send
var action = params.action;
var message = params.message;
var customData = params.customData;

// use to custom tweak whatever payload you wish to send
var pushQuery = new Parse.Query(Parse.Installation);
pushQuery.equalTo("deviceType", "android");

var payload = {"data": {
"alert": message,
"action": action,
"customdata": customData}
};

// Note that useMasterKey is necessary for Push notifications to succeed.

Parse.Push.send({
where: pushQuery, // for sending to a specific channel data: payload,
}, { success: function() {
console.log("#### PUSH OK");
}, error: function(error) {
console.log("#### PUSH ERROR" + error.message);
}, useMasterKey: true});

response.success('success');
});
untitled

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions