c - 使用 Arduino Yun 发送 POST 请求

标签 c arduino arduino-yun pushbullet

以下 POST 从终端通过 cURL 工作:

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

但是,我无法在 Arduino IDE(C 语言)中复制它。我以为我可以使用 HTTPClient 对象,但是我在文档中只看到了 GET 方法,而没有看到 POST 方法。

我将不胜感激任何对正确方向的点头。

最佳答案

我会试试这个:

HttpClient client;
client.setHeader("Authorization: Bearer <access token here>");
client.addHeader();
client.setHeader("Content-Type: application/json");
client.addHeader();
client.post("https://api.pushbullet.com/v2/pushes", "{\"type\": \"note\", \"title\": \"Note Title\", \"body\": \"Note Body\"}"

我没有用于测试的 Yún。尽管有 post 方法 not being documented , 它 does appear to exist ..

关于c - 使用 Arduino Yun 发送 POST 请求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29834066/

相关文章:

python - Arduino Yun Python 脚本

c - 字符串输入到 flex 词法分析器

android - Android可以被外围设备从 sleep 状态唤醒吗?

c - linux内核源代码起点在哪里?

c++ - 我的 sim800l 仅在连接到笔记本电脑并打开串行监视器时才工作

c - 如果我使用共享库,如何在 Arduino 中构建和上传代码?

javascript - 从浏览器向 Arduino 发送请求具有高延迟

parse-platform - Parse.com Arduino Yun SDK 快速入门教程不​​起作用

c - 通过C控制电机

c - 相当于cuda中的memalign