I'm trying to make a JSON request in C with HTTP, but whenever I run my code it returns that there are no values to be processed. I changed the https and accesskey path for security reasons
void sendAPI(const char *json) { CURL *curl; CURLcode res; curl = curl_easy_init(); if (!curl) { finish_with_error("Falha ao inicializar cURL"); } curl_easy_setopt(curl, CURLOPT_URL, "https://monitoramento.loralora/api/"); struct curl_slist *headers = NULL; headers = curl_slist_append(headers, "Content-Type: application/json"); headers = curl_slist_append(headers, "acesskey: 49046a182af34gase52dfdbe8637940"); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, json); res = curl_easy_perform(curl); if (res != CURLE_OK) { fprintf(stderr, "Erro na requisição cURL: %s\n", curl_easy_strerror(res)); } curl_slist_free_all(headers); curl_easy_cleanup(curl);} switch (tipoLeitura) { case 0: if (getRead()) { sprintf(json, "{\"SensorId\":\"%s\",\"codeVersion\":\"%s\",\"Measures\": [{\"SensorComponentId\":\"%s_volh\",\"Measure\":%5.2f}, {\"SensorComponentId\":\"%s_cht\",\"Measure\":%5.2f}, {\"SensorComponentId\":\"%s_prem\",\"Measure\":%5.2f}, {\"SensorComponentId\":\"%s_ahp\",\"Measure\":%5.2f}, {\"SensorComponentId\":\"%s_bt\",\"Measure\":%5.2f}, {\"SensorComponentId\":\"%s_lt\",\"Measure\":%5.2f}]}", sensorID, version, sensorID, HeliumLevel, sensorID, ColdHeadTemperature, sensorID, MagnetPressure, sensorID, AverageHeaterPower, sensorID, BoreTemperature, sensorID, LinkTemperature); } break; default: break; } if ((unsigned)strlen(json) > 0) { // printf("JSON a ser enviado: %s\n", json); sendDataSensor(json); // Envia o JSON via HTTP POST }I've only tried an API connection test and it worked, I had no problems, I only had problems sending the information via JSON.