Awesome, thank you!!
I don’t even have to use MQTT directly, there is an HTTP endpoint:
linux01:~# curl --data "" http://linux06:12101/api/train
Training completed in 64.18 second(s)linux01:~#
In case somebody else tries to do that as well - you have to send empty data to force POST.
GET does not work (like the documentation correctly suggests):
linux01:~# curl http://linux06:12101/api/train
Thanks a lot for pointing me to the documentation!!!
I had really not assumed there was a published interface to do just that and simply hadn’t looked because of that.
If anyone wants to do it with PHP here’s a way to do it:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, Configuration::$rhasspyMasterUrl."/api/train");
curl_setopt($ch, CURLOPT_POST, 1);
//curl_setopt($ch, CURLOPT_POSTFIELDS, "postvar1=value1&postvar2=value2&postvar3=value3");
curl_setopt($ch, CURLOPT_POSTFIELDS, ""); // Send empty data to force POST
// In real life you should use something like:
// curl_setopt($ch, CURLOPT_POSTFIELDS,
// http_build_query(array('postvar1' => 'value1')));
// Receive server response ...
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$server_output = curl_exec($ch);
// Further processing ...
if (strpos($server_output, 'Training completed') !== false)