[Solved] Dashboard HTTP API difference between v4.4.3 and 4.1.1?

api

#1

Hello,

I’m seeing strange behaviour (regression?) comparing Grafana 4.1.1 with 4.4.3:

http://docs.grafana.org/http_api/dashboard/#search-dashboards

grafana-4.1.1-1484211277.x86_64

$ curl -H "Authorization: Bearer eyJrIjoiakpOcmRGWXNra0FnYXZtQU1qV2dqOTNMa0hBQ0lUTmQiLCJuIjoidmlzdWFsaXplciIsImlkIjoxfQ==" http://192.168.122.8:3000/api/search?tag=mytag
[{"id":5,"title":"Dashboard for 0x0011750101790ee0","uri":"db/dashboard-for-0x0011750101790ee0","type":"dash-db","tags":["mytag"],"isStarred":false},{"id":4,"title":"Dashboard for 0x0011750101790ef2","uri":"db/dashboard-for-0x0011750101790ef2","type":"dash-db","tags":["mytag"],"isStarred":false},{"id":2,"title":"Dashboard for 0x0011750101790f0a","uri":"db/dashboard-for-0x0011750101790f0a","type":"dash-db","tags":["mytag"],"isStarred":false},{"id":1,"title":"Dashboard for 0x00117501017910a3","uri":"db/dashboard-for-0x00117501017910a3","type":"dash-db","tags":["mytag"],"isStarred":false},{"id":3,"title":"Dashboard for 0x00117501017910ad","uri":"db/dashboard-for-0x00117501017910ad","type":"dash-db","tags":["mytag"],"isStarred":false},{"id":8,"title":"Dashboard for mo79","uri":"db/dashboard-for-mo79","type":"dash-db","tags":["mytag"],"isStarred":false}]

grafana-4.4.3-1.x86_64

$ curl -H "authorization: Bearer eyJrIjoiNUg0aUpZVmVreVBKTm9UckpoZzBJSjFORTdyOFRCRTYiLCJuIjoiaWJtcyIsImlkIjo1fQ==" http://192.168.122.9:3000/api/search?tag=mytag

$

(nothing)

In Perl, showing that the content of response is some binary blob instead of JSON (!):

$ perl -d ./grafana.pl

Loading DB routines from perl5db.pl version 1.32
Editor support available.

Enter h or `h h' for help, or `man perldebug' for more help.

main::(./grafana.pl:7): require HTTP::Headers;
  DB<1> c 20
main::(./grafana.pl:20):        print Dumper($response);
  DB<2> x $response->content
0  "\cU\cC\cA\c@\cB\cB\cJ"					<======== HERE

  DB<3> x $response
0  HTTP::Response=HASH(0x1492fc0)
   '_content' => "\cU\cC\cA\c@\cB\cB\cJ"
   '_headers' => HTTP::Headers=HASH(0x14a0a28)
      '::std_case' => HASH(0x14a0f08)
         'client-date' => 'Client-Date'
         'client-peer' => 'Client-Peer'
         'client-response-num' => 'Client-Response-Num'
      'client-date' => 'Mon, 11 Sep 2017 08:35:59 GMT'
      'client-peer' => '192.168.122.9:3000'
      'client-response-num' => 1
   '_msg' => 'Assumed OK'
   '_protocol' => 'HTTP/0.9'
   '_rc' => 200
   '_request' => HTTP::Request=HASH(0xf8ed40)
      '_content' => ''
      '_headers' => HTTP::Headers=HASH(0xf83cc8)
         'authorization' => 'Bearer eyJrIjoiNUg0aUpZVmVreVBKTm9UckpoZzBJSjFORTdyOFRCRTYiLCJuIjoiaWJtcyIsImlkIjo1fQ=='
         'user-agent' => 'libwww-perl/6.26'
      '_method' => 'GET'
      '_uri' => URI::http=SCALAR(0xca57f0)
         -> 'http://192.168.122.9:3000/api/search?tag=mytag'
      '_uri_canonical' => URI::http=SCALAR(0xca57f0)
         -> REUSED_ADDRESS
  DB<4>

What’s changed? Should the documentation be updated or is this a regression?

thanks
Marek


#2

My bad. HTTP vs HTTPS :frowning: