mirror of
https://github.com/grafana/grafana.git
synced 2024-11-28 03:34:15 -06:00
4835539248
Makes all aliases rooted to /docs/grafana/latest. Fixes #21240
150 lines
3.1 KiB
Markdown
150 lines
3.1 KiB
Markdown
+++
|
|
title = "Folder Permissions HTTP API "
|
|
description = "Grafana Folder Permissions HTTP API"
|
|
keywords = ["grafana", "http", "documentation", "api", "folder", "permission", "permissions", "acl"]
|
|
aliases = ["/docs/grafana/latest/http_api/dashboardpermissions/"]
|
|
type = "docs"
|
|
[menu.docs]
|
|
name = "Folder Permissions"
|
|
parent = "http_api"
|
|
+++
|
|
|
|
# Folder Permissions API
|
|
|
|
This API can be used to update/get the permissions for a folder.
|
|
|
|
Permissions with `folderId=-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
|
|
|
|
## Get permissions for a folder
|
|
|
|
`GET /api/folders/:uid/permissions`
|
|
|
|
Gets all existing permissions for the folder with the given `uid`.
|
|
|
|
**Example request**:
|
|
|
|
```http
|
|
GET /api/folders/nErXDvCkzz/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** - Folder not found
|
|
|
|
## Update permissions for a folder
|
|
|
|
`POST /api/folders/:uid/permissions`
|
|
|
|
Updates permissions for a folder. This operation will remove existing permissions if they're not included in the request.
|
|
|
|
**Example request**:
|
|
|
|
```http
|
|
POST /api/folders/nErXDvCkzz/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
|