Dashboard API - Unauthorized

Hi,

I’m getting started with the Dashboard API, but cannot seem to get a simple GET to work.

I’m following the example here.

Here is my request with my values replaced by placeholders:

GET http://localhost:3000/api/dashboards/uid/[dashboardUID] HTTP/1.1
Accept: application/json
Content-Type: application/json
Authorization: [adminUsername] [adminPassword]

Admin has access to all dashboards through UI.
I receive always:

HTTP/1.1 401 Unauthorized
Cache-Control: no-store
Content-Type: application/json; charset=UTF-8
X-Content-Type-Options: nosniff
X-Frame-Options: deny
X-Xss-Protection: 1; mode=block
Date: Mon, 24 Jun 2024 12:20:27 GMT
Content-Length: 102

{
  "extra": null,
  "message": "Unauthorized",
  "messageId": "auth.unauthorized",
  "statusCode": 401,
  "traceID": ""
}

I’ve checked the credentials multiple times. Even tried using the encrypted PW. What is going wrong?

You need basic auth header.

Authorization: Basic <credentials>

, where <credentials> is the Base64 encoding of ID and password joined by a single colon

Thanks! I’d thought “Bearer” was the username in the example :sweat_smile:
I’m a bit new to making these requests, but have now found HTTP API | Grafana documentation

1 Like