mirror of
https://github.com/librenms/librenms.git
synced 2024-09-22 02:48:37 +00:00
Update Api.php to include Options variable in the Body for POST requests (#13167)
* Update Api.php * Update Api.php Correct syntax for variable replacement : '{{ $' . $metric . ' }}' * style Co-authored-by: PipoCanaja <38363551+PipoCanaja@users.noreply.github.com>
This commit is contained in:
parent
d646562e4e
commit
71cd81269a
@ -85,6 +85,10 @@ class Api extends Transport
|
||||
$res = $client->request('PUT', $host, $request_opts);
|
||||
} else { //Method POST
|
||||
$request_opts['form_params'] = $query;
|
||||
foreach ($query as $metric => $value) { // replace all variables defined in Options and found in Body for their values
|
||||
$body = str_replace('{{ $' . $metric . ' }}', $value, $body);
|
||||
}
|
||||
$request_opts['body'] = $body;
|
||||
$res = $client->request('POST', $host, $request_opts);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user