2015-02-07 109 views
1

我正在使用Pushbullet's API的应用程序工作,但在运行示例代码https://docs.pushbullet.com/v2/pushes/时遇到奇怪的错误。来自cURL的Pushbullet API - 无效请求

我执行以下cURL命令(在Windows中):

curl -k -u <MY_API_KEY>: -X POST https://api.pushbullet.com/v2/pushes --header 'Content-Type: application/json' --data-binary '{"type": "note", "title": "Note Title", "body": "Note Body"}' 

...但它不断产生以下错误:

{"error": {"type":"invalid_request","message":"The param 'type' has an invalid value.","param":"type","cat":"\u003e:3"}} 

它也产生这个错误: enter image description here

其他文档中的其他命令的其他命令工作正常......只是这一个。

有什么建议吗?谢谢您的帮助! :)

回答

3

它看起来像Windows不支持命令行上的这些类型的引号。下面是工作的例子:

curl https://api.pushbullet.com/v2/pushes -X POST -u <access token>: --header "Content-Type: application/json" --data-binary "{\"type\": \"note\", \"title\":\"Note Title\", \"body\": \"Note Body\"}"

我想我会尝试的东西,具有不易混淆的行为来代替卷曲的例子。