[release-12.3.0] Restructure As code and developer resources (#113969)
Co-authored-by: Roberto Jiménez Sánchez <roberto.jimenez@grafana.com> Co-authored-by: Anna Urbiztondo <anna.urbiztondo@grafana.com>
This commit is contained in:
@@ -0,0 +1,187 @@
|
||||
---
|
||||
aliases:
|
||||
- ../../../http_api/dashboard_permissions/ # /docs/grafana/next/http_api/dashboard_permissions/
|
||||
- ../../../http_api/dashboardpermissions/ # /docs/grafana/next/http_api/dashboardpermissions/
|
||||
- ../../../developers/http_api/dashboard_permissions/ # /docs/grafana/next/developers/http_api/dashboard_permissions/
|
||||
canonical: https://grafana.com/docs/grafana/latest/developer-resources/api-reference/http-api/dashboard_permissions/
|
||||
description: Grafana Dashboard Permissions HTTP API
|
||||
keywords:
|
||||
- grafana
|
||||
- http
|
||||
- documentation
|
||||
- api
|
||||
- dashboard
|
||||
- permission
|
||||
- permissions
|
||||
- acl
|
||||
labels:
|
||||
products:
|
||||
- enterprise
|
||||
- oss
|
||||
- cloud
|
||||
title: Dashboard Permissions HTTP API
|
||||
---
|
||||
|
||||
# Dashboard Permissions API
|
||||
|
||||
This API can be used to update/get the permissions for a dashboard.
|
||||
|
||||
Permissions with `dashboardId=-1` are the default permissions for users with the Viewer and Editor roles. Permissions can be set for a user, a team or a role (Viewer or Editor). Permissions cannot be set for Admins - they always have access to everything.
|
||||
|
||||
The permission levels for the permission field:
|
||||
|
||||
- 1 = View
|
||||
- 2 = Edit
|
||||
- 4 = Admin
|
||||
|
||||
> If you are running Grafana Enterprise, for some endpoints you'll need to have specific permissions. Refer to [Role-based access control permissions](/docs/grafana/latest/administration/roles-and-permissions/access-control/custom-role-actions-scopes/) for more information.
|
||||
|
||||
## Get permissions for a dashboard
|
||||
|
||||
`GET /api/dashboards/uid/:uid/permissions`
|
||||
|
||||
Gets all existing permissions for the dashboard with the given `uid`.
|
||||
|
||||
**Required permissions**
|
||||
|
||||
See note in the [introduction](#dashboard-permission-api) for an explanation.
|
||||
|
||||
<!-- prettier-ignore-start -->
|
||||
| Action | Scope |
|
||||
| ----------------------------- | ------------------------------------------------------------------------------------------------------- |
|
||||
| `dashboards.permissions:read` | <ul><li>`dashboards:*`</li><li>`dashboards:uid:*`</li><li>`folders:*`</li><li>`folders:uid:*`</li></ul> |
|
||||
{ .no-spacing-list }
|
||||
<!-- prettier-ignore-end -->
|
||||
|
||||
**Example request**:
|
||||
|
||||
```http
|
||||
GET /api/dashboards/uid/dHEquNzGz/permissions HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
||||
```
|
||||
|
||||
**Example Response**
|
||||
|
||||
```http
|
||||
HTTP/1.1 200 OK
|
||||
Content-Type: application/json; charset=UTF-8
|
||||
Content-Length: 551
|
||||
|
||||
```
|
||||
|
||||
Status Codes:
|
||||
|
||||
- **200** - Ok
|
||||
- **401** - Unauthorized
|
||||
- **403** - Access denied
|
||||
- **404** - Dashboard not found
|
||||
|
||||
## Update permissions for a dashboard
|
||||
|
||||
`POST /api/dashboards/uid/:uid/permissions`
|
||||
|
||||
Updates permissions for a dashboard. This operation will remove existing permissions if they're not included in the request.
|
||||
|
||||
**Required permissions**
|
||||
|
||||
See note in the [introduction](#dashboard-permission-api) for an explanation.
|
||||
|
||||
<!-- prettier-ignore-start -->
|
||||
| Action | Scope |
|
||||
| ------------------------------ | ------------------------------------------------------------------------------------------------------- |
|
||||
| `dashboards.permissions:write` | <ul><li>`dashboards:*`</li><li>`dashboards:uid:*`</li><li>`folders:*`</li><li>`folders:uid:*`</li></ul> |
|
||||
{ .no-spacing-list }
|
||||
<!-- prettier-ignore-end -->
|
||||
|
||||
**Example request**:
|
||||
|
||||
```http
|
||||
POST /api/dashboards/uid/dHEquNzGz/permissions
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
||||
|
||||
{
|
||||
"items": [
|
||||
{
|
||||
"role": "Viewer",
|
||||
"permission": 1
|
||||
},
|
||||
{
|
||||
"role": "Editor",
|
||||
"permission": 2
|
||||
},
|
||||
{
|
||||
"teamId": 1,
|
||||
"permission": 1
|
||||
},
|
||||
{
|
||||
"userId": 11,
|
||||
"permission": 4
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
JSON body schema:
|
||||
|
||||
- **items** - The permission items to add/update. Items that are omitted from the list will be removed.
|
||||
|
||||
**Example response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200 OK
|
||||
Content-Type: application/json; charset=UTF-8
|
||||
Content-Length: 35
|
||||
|
||||
```
|
||||
|
||||
Status Codes:
|
||||
|
||||
- **200** - Ok
|
||||
- **401** - Unauthorized
|
||||
- **403** - Access denied
|
||||
- **404** - Dashboard not found
|
||||
"items": [
|
||||
{
|
||||
"role": "Viewer",
|
||||
"permission": 1
|
||||
},
|
||||
{
|
||||
"role": "Editor",
|
||||
"permission": 2
|
||||
},
|
||||
{
|
||||
"teamId": 1,
|
||||
"permission": 1
|
||||
},
|
||||
{
|
||||
"userId": 11,
|
||||
"permission": 4
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
JSON body schema:
|
||||
|
||||
- **items** - The permission items to add/update. Items that are omitted from the list will be removed.
|
||||
|
||||
**Example response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200 OK
|
||||
Content-Type: application/json; charset=UTF-8
|
||||
Content-Length: 35
|
||||
|
||||
{"message":"Dashboard permissions updated"}
|
||||
```
|
||||
|
||||
Status Codes:
|
||||
|
||||
- **200** - Ok
|
||||
- **401** - Unauthorized
|
||||
- **403** - Access denied
|
||||
- **404** - Dashboard not found
|
||||
Reference in New Issue
Block a user