使用HTTP API将仪表板从Grafana共享到另一个PHP Web应用程序的仪表板中,可以使用curl为我提供JSON数据
引用了http://docs.grafana.org/http_api/dashboard/,并使用GET / api / dashboards / uid /:uid
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_PORT => "3000",
CURLOPT_URL => here comes grafana dashboard url to share,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"authorization: Basic YWRtaW46ZHluRWtvZGU=",
"cache-control: no-cache"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err; ?>
<?php } else {
echo $response;
}
在响应中获取JSON数据。 如何使用此json在Web应用程序上获得特定的Grafana仪表板访问权限?