Thanks for the explanation on the authentication, this makes more sense.
Having said all that, we’re still struggling to get mDashNotify() to work for HTTP POST requests. We can get things to work with the ESP-IDF HTTP client and with curl.
It would appear there is either a problem with mDashNotify() or a problem with the way we’re using it. Are there any debug options to see what final HTTP message is being generated from the mDash side and the HTTP response?
We’d prefer to avoid adding the unnecessary overhead of the ESP-IDF HTTP client, but may not have a choice if we can’t get mDashNotify() to work.
Working ESP-IDF Example:
snprintf(url, sizeof(url), "https://%s/%s/Messages.json", g_config.alertSmsURL, g_config.alertSmsSID);
snprintf(message, sizeof(message), "Hello!");
snprintf(parameters, sizeof(parameters), "To=%s&From=%s&Body=\"%s\"",
g_config.alertSmsToNumber, g_config.alertSmsFromNumber, message);
esp_http_client_config_t config = {
.url = url,
.username = g_config.alertSmsSID,
.password = g_config.alertSmsAuthToken,
.auth_type = HTTP_AUTH_TYPE_BASIC,
.method = HTTP_METHOD_POST,
.transport_type = HTTP_TRANSPORT_OVER_TCP,
.timeout_ms = 5000,
.buffer_size = 1000,
};
esp_http_client_handle_t client = esp_http_client_init(&config);
esp_http_client_set_post_field(client, parameters, sizeof(parameters));
esp_err_t err = esp_http_client_perform(client);
Failing mDashNotify() Example
snprintf(url, sizeof(url), "https://%s:%s@%s/%s/Messages.json", g_config.alertSmsSID,
g_config.alertSmsAuthToken, g_config.alertSmsURL, g_config.alertSmsSID);
snprintf(message, sizeof(message), "Hello!");
snprintf(parameters, sizeof(parameters), "To=\"%s\"&From=\"%s\"&Body=\"%s\"",
g_config.alertSmsToNumber, g_config.alertSmsFromNumber, message);
mDashNotify("HTTP.Request", "{%Q:%Q, %Q:%Q, %Q:%Q}",
"url", url,
"method", "POST",
"body", parameters);