以下 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/