Skip to content

Instantly share code, notes, and snippets.

@jtuttas
Last active June 11, 2020 14:28
Show Gist options
  • Save jtuttas/c37c03d91f38b13d901e7914a7fa9dfd to your computer and use it in GitHub Desktop.
Save jtuttas/c37c03d91f38b13d901e7914a7fa9dfd to your computer and use it in GitHub Desktop.
Daten in die adafruit Cloud eintragen
curl --header "Content-Type: application/json" --header "x-aio-key: aio_dUnx007cL54aZqVs9jemddNy6hVj" --data "{\"value\":18}" https://io.adafruit.com/api/v2/jtuttas/feeds/fiae19/data
var settings = {
"async": true,
"crossDomain": true,
"url": "https://io.adafruit.com/api/v2/jtuttas/feeds/esp32/data",
"method": "POST",
"headers": {
"content-type": "application/json",
"x-aio-key": "geheim",
"cache-control": "no-cache"
},
"processData": false,
"data": "{\n\t\"value\":18.5\n}"
}
$.ajax(settings).done(function (response) {
console.log(response);
});
import http.client
conn = http.client.HTTPSConnection("io.adafruit.com")
payload = "{\n\t\"value\":18.5\n}"
headers = {
'content-type': "application/json",
'x-aio-key': "geheim",
'cache-control': "no-cache"
}
conn.request("POST", "/api/v2/jtuttas/feeds/esp32/data", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
<?php
$request = new HttpRequest();
$request->setUrl('https://io.adafruit.com/api/v2/jtuttas/feeds/esp32/data');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders(array(
'cache-control' => 'no-cache',
'x-aio-key' => 'geheim',
'content-type' => 'application/json'
));
$request->setBody('{
"value":18.5
}');
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--header 'x-aio-key: geheim' \
--header 'cache-control: no-cache' \
--body-data '{\n "value":18.5\n}' \
--output-document \
- https://io.adafruit.com/api/v2/jtuttas/feeds/esp32/data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment