gpt4 book ai didi

c - 使用 Arduino Yun 发送 POST 请求

转载 作者:太空宇宙 更新时间:2023-11-04 02:43:15 25 4
gpt4 key购买 nike

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

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com