0

Using HTTP API to share dashboard from Grafana into another PHP web application's dashboard gives me JSON data using curl

Referred http://docs.grafana.org/http_api/dashboard/ and used 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;
}

In the response get JSON data. How can I use this json to get particular Grafana dashboard access on my web application?

Mohaks
  • 3
  • 4

0 Answers0