![](/img/trans.png)
[英]HTTP Event Collector: How to send logs to Splunk Cloud from command line using curl?
[英]How to send a curl request using the command line in Windows
我需要发送一个curl请求来从苹果获得推送通知,我尝试使用node.js和命令行来执行,但是当我发送它时,我的设备上没有任何通知,仅使用外部json .txt,但需要在命令行本身中发送此json对象。
我的第一个例子不起作用
let args = `-v -d '{\"aps\":{\"alert\":{\"title\":\"SENT_BY_NAME\",\"subtitle\":\"MESSAGE\",\"body\":\"MESSAGE\"},\"badge\":1,\"sound\":\"default\"}}' -H Content-Type:application/json -H apns-topic:com.myapp.ios -H apns-expiration:1 -H apns-priority:10 --http2 --cert apple_push_notification_certificate.pem:pass https://api.push.apple.com:443/3/device/tokenofdevice`;
这个例子的工作,但我需要一些类似于我的第一个例子
let args = `-v -d @json.txt -H Content-Type:application/json -H apns-topic:com.myapp.ios -H apns-expiration:1 -H apns-priority:10 --http2 --cert apple_push_notification_certificate.pem:pass https://api.push.apple.com:443/3/device/tokenofdevice`;
这个新给我需要一些帮助,谢谢
尝试将JSON字符串括在双引号中:
... -d "{\"aps\":{\"alert\":{\"title\":\"SENT_BY_NAME\",\"subtitle\":\"MESSAGE\",\"body\":\"MESSAGE\"},\"badge\":1,\"sound\":\"default\"}}"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.