C (Curl)

ThingsOn HTTP API / C

C programlama dilini kullanarak platforma veri göndermek için aşağıdaki örneği kullanabilirsiniz.

Bu örnekte LibCurl kullanılmıştır: https://curl.haxx.se/libcurl/c/

Write
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "http://cloud.thingson.io:8086/write?db=[DB_NAME]");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Authorization: Basic [API_KEY]");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "[TABLE_NAME] [FIELD_1=90],[FIELD_2=90],[FIELD_3=90]");
CURLcode ret = curl_easy_perform(hnd);