pushbullet api解码(v2 / push)

时间:2015-07-21 01:51:25

标签: zabbix pushbullet

我想使用pushbullet api(v2 / push)来推送消息,但如果我在标题或正文中包含'%'字符,服务器会给我以下错误:

  

{“error”:{“type”:“invalid_request”,“message”:“无法解码urlencoded的POST表单正文。”,“cat”:“〜(= ^‥^)ノ”}}

如何解决此问题?

request: curl https://api.pushbullet.com/v2/pushes -k -u token: -d type=note -d title="%test" -d body="%%test" -X POST

1 个答案:

答案 0 :(得分:0)

x-www-form-urlencoded并不是最直接的格式。你可以使用curl和--data-urlencode选项。您也可以尝试使用此工具对值进行编码:http://meyerweb.com/eric/tools/dencoder/

这应该产生urlencoded输出,例如你的请求看起来更像:

curl -u token: https://api.pushbullet.com/v2/pushes --header "Content-Type: application/x-www-form-urlencoded" --data-binary 'type=note&title=TITLETEXT&body=%25BODYTEXT'