首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Monaca推送后端管理API不起作用

Monaca推送后端管理API不起作用
EN

Stack Overflow用户
提问于 2014-05-01 15:15:35
回答 1查看 694关注 0票数 1

我正在尝试教程(http://monaca.mobi/en/blog/archives/265)使用命令提示符中的curl向我的iPhone发送推送通知。

如果我用这个:

代码语言:javascript
复制
curl --insecure https://cloud.monaca.mobi/manage/json-rpc/##### --data '{"jsonrpc": "2.0", "id": 1, "method": "Push.send", "params": { "pushProjectId": "#####", "platform": "ios", "target": "debugger", "buildType": "debug", "message": "manage sample" , "json" : "{ \"url\" : \"http://www.google.co.jp\" }", "deviceIdList": ["#####"] } }' --header 'X-Monaca-Backend-Management-API-Key: #####'  

我知道这些错误:

代码语言:javascript
复制
curl: (6) Could not resolve host: id
curl: (6) Could not resolve host: 1,
curl: (6) Could not resolve host: method
curl: (6) Could not resolve host: Push.send,
curl: (6) Could not resolve host: params
curl: (3) [globbing] unmatched brace in colum
curl: (6) Could not resolve host: pushProject
curl: (6) Could not resolve host: ###
curl: (6) Could not resolve host: platform
curl: (6) Could not resolve host: ios,
curl: (6) Could not resolve host: target
curl: (6) Could not resolve host: debugger,
curl: (6) Could not resolve host: buildType
curl: (6) Could not resolve host: debug,
curl: (6) Could not resolve host: message
curl: (6) Could not resolve host: manage samp
curl: (6) Could not resolve host: ,
curl: (6) Could not resolve host: json
curl: (7) Failed connect to :80; No error   

然后,我尝试将数据保存到senddata.json文件中。

代码语言:javascript
复制
{
    "jsonrpc": "2.0", 
    "method": "Push.send", 
    "params": { 
        "pushProjectId": "#####", 
        "platform": "ios", 
        "target": "debugger", 
        "buildType": "debug", 
        "message": "manage sample" , 
        "json" : "{ \"url\" : \"http://www.google.co.jp\" }", 
        "deviceIdList": [ "#####" ] 
     },
     "id": 1
}

并使用此命令调用:

代码语言:javascript
复制
curl --insecure https://cloud.monaca.mobi/manage/##### --data C:\myfilepath\senddata.json -H "Content-Type: application/json" --header "X-Monaca-Backend-Management-API-Key: #####"  

但它也会返回以下错误:

代码语言:javascript
复制
{"jsonrpc":"2.0","id":null,"error":{"code":-32700,"message":"Parse error"}}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-05-03 05:09:47

问题解决了。在windows上运行命令提示符下的curl命令似乎存在一些返回错误的问题,例如curl: (3) [globbing] unmatched brace in colum

如果您面临相同的问题,请按照/重新检查以下步骤:

  1. 检查是否在Windows上正确安装了卷曲(http://guides.instructure.com/s/2204/m/4214/l/83393-how-do-i-install-and-use-curl-on-a-windows-machine)
  2. 安装和使用cygwin终端 (http://hariniachala.blogspot.com/2012/08/running-curl-commands-in-command-prompt.html) 因为DOS环境似乎不喜欢单引号。任何使用单引号环绕值的示例在windows上都是无效的。单引号必须替换为双引号。

希望这能有所帮助。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/23410629

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档