Http .post not sending data



Ok I have been making some baby steps as I would like to use influxdb and kapacitor for a project I am working on. However I can’t figure or even hack my way around .post returning an empty array.

These are my scripts:

dbrp "TEST_MEASUREMENTS"."autogen"

		SELECT mean(data)
		FROM "TEST_MEASUREMENTS"."autogen"."temperature"
		WHERE processed != true
		.crit(lambda: "mean" > 30)
		.message('observableName: {{.Name}} mean: {{index .Fields "mean"}} myId: {{index .Tags "my_id"}}')

This triggers the alert and is logged but the post parameters are empty. This is a php script I try to use to extract it:

$data = $this->params()->fromPost();
error_log("Data: $data");

The array returned is empty. Though it logs correctly. This is a similar problem to what I have: but the answer is not relevant to me.


I found the solution to the problem for anyone facing a similar issue.

header(‘Content-Type: application/json’);
$data = json_decode(file_get_contents(‘php://input’),true);

Your message details will be in $data. I got this here: