Hi,
I use OneSignal.com for notification.
I read the instruction on how to send a notification, I try it with node.js
Worked on my first try with the oneSignal exemple for node.js.
Now, I try to convert in vfp9 to have the capability to send notification directly from my VFP application.
But, I always get the same error result whatever what I try.
Here is the error :
{"errors":["Please include a case-sensitive header of Authorization: Basic \u003cYOUR-REST-API-KEY-HERE\u003e with a valid REST API key."],"reference":["]}
Here is the vfp code I have so far
Can someone help me?
Thanks for you help.
Bob
I use OneSignal.com for notification.
I read the instruction on how to send a notification, I try it with node.js
Worked on my first try with the oneSignal exemple for node.js.
Now, I try to convert in vfp9 to have the capability to send notification directly from my VFP application.
But, I always get the same error result whatever what I try.
Here is the error :
{"errors":["Please include a case-sensitive header of Authorization: Basic \u003cYOUR-REST-API-KEY-HERE\u003e with a valid REST API key."],"reference":["]}
Here is the vfp code I have so far
Can someone help me?
Code:
CLEAR
loXMLHTTP = CREATEOBJECT("MSXML2.XMLHTTP")
cUrl="[URL unfurl="true"]https://onesignal.com/api/v1/notifications"[/URL]
loXMLHTTP.OPEN("POST", cUrl ,.F.)
loXMLHTTP.setRequestHeader("Content-Type", "application/json; charset=utf-8")
myheader = STRCONV("ATcyNDU1MmEtMDA5Yi00ZDNmLTkxNzMtNTc4MTUzOGY2ZjE5", 13)
loXMLHTTP.setRequestHeader("Authorization", "Basic " + myheader + "")
cmessage = '{"app_id": "16eb9e36-19a5-X431-a10f-bb6968058215",' + ;
'"contents": {"en": "English Message"},' + ;
'"included_segments": ["All"]}'
cmessage = CREATEBINARY(cMessage)
loXMLHTTP.send(cMessage)
?loXMLHTTP.responseText
RETURN
Thanks for you help.
Bob