Hey Jonathan,
You can also use the Jansson module to create the JSON request. For example, in one of my configs, I have a route that looks basically like:
$var(params) = $null;
jansson_set("string", "request.uri", "$ru", "$var(params)");
jansson_set("string", "request.method", "$rm", "$var(params)");
jansson_set("string", "request.domain", "$rd", "$var(params)");
/// other fields set here
http_set_timeout(5000);
http_set_method("POST");
http_append_header("Content-Type: application/json");
Then a API_ROUTE_REPLY block that processes the response like:
if $http_ok {
if $http_rs == 200 {
$var(action) = $null;
jansson_get_field("$http_rb", "authentication.action", "$var(action)");
// other stuff
}
}
Hopefully that's helpful.
Best,
Colin