今天测试极光推送的时候,根据官网的给的例子使用curl调用的时候出现以下错误:
{"error":{"code":1002,"message":"Missing parameter"}}* Connection #0 to host api.jpush.cn left intac
这是因为 windows版本下单引号要改成双引号,json格式数据中双引号要加\转义,列如官网的例子是
curl --insecure -X POST -v https://api.jpush.cn/v3/push -H "Content-Type: application/json"
-u "appKey:masterSecret"
-d '{"platform":"all","audience":"all","notification":{"alert":"Hi,JPush!"}}'
在windows下改成即可正常请求:
curl --insecure -X POST -v https://api.jpush.cn/v3/push -H "Content-Type: application/json"
-u "appKey:masterSecret"
-d "{\"platform\":\"all\",\"audience\":\"all\",\"notification\":{\"alert\":\"Hi,JPush!\"}}"