【发布时间】:2015-01-12 15:07:59
【问题描述】:
我正在尝试执行将发送推送通知的 cURL 命令。我有可以执行此操作的 cURL 命令,但现在我只需要在节点中执行它。
当前的 cURL 是:
curl -v -X POST -u "<shared>:<secret>" -H "Content-type: application/json" -H "Accept: application/vnd.urbanairship+json; version=3;" --data '{"audience" : {"tag":[testTag]}, "device_types" : "all", "notification" : {"alert": "Test push notification"} }' https://go.urbanairship.com/api/push/"
我当前在节点中的请求是:
request({
url: "https://go.urbanairship.com/api/push/",
method: "POST",
json: {
audience : {
tag : [ "testTag" ]
},
device_types : "all",
notification : {
alert : "Test push notification"
}
}
});
我不确定如何传递共享和秘密,或者即使这是最佳实践。
【问题讨论】:
标签: node.js curl request urbanairship.com