2022-05-26 23:06:25 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								---
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								aliases:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  -  /docs/grafana/latest/developers/http_api/datasource_permissions/
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  -  /docs/grafana/latest/http_api/datasource_permissions/
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  -  /docs/grafana/latest/http_api/datasourcepermissions/
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								description: Data Source Permissions API
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								keywords:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  -  grafana
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  -  http
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  -  documentation
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  -  api
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  -  datasource
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  -  permission
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  -  permissions
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  -  acl
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  -  enterprise
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								title: 'Datasource Permissions HTTP API '
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								---
							 
						 
					
						
							
								
									
										
										
										
											2018-10-31 02:02:12 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-09-20 06:22:38 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								# Data Source Permissions API
 
							 
						 
					
						
							
								
									
										
										
										
											2018-10-31 02:02:12 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-05-27 20:42:51 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								>  The Data Source Permissions is only available in Grafana Enterprise. Read more about [Grafana Enterprise]({{< relref "../../enterprise/" >}}).
 
							 
						 
					
						
							
								
									
										
										
										
											2018-10-31 02:02:12 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-05-27 20:42:51 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								>  If you are running Grafana Enterprise, for some endpoints you'll need to have specific permissions. Refer to [Role-based access control permissions]({{< relref "../../enterprise/access-control/custom-role-actions-scopes/" >}}) for more information.
 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-29 23:45:27 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-09-20 06:04:56 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								This API can be used to enable, disable, list, add and remove permissions for a data source.
							 
						 
					
						
							
								
									
										
										
										
											2018-10-31 02:02:12 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Permissions can be set for a user or a team. Permissions cannot be set for Admins - they always have access to everything.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								The permission levels for the permission field:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								-  1 = Query
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-09-20 06:04:56 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								## Enable permissions for a data source
 
							 
						 
					
						
							
								
									
										
										
										
											2018-10-31 02:02:12 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								`POST /api/datasources/:id/enable-permissions` 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-09-20 06:04:56 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								Enables permissions for the data source with the given `id` . No one except Org Admins will be able to query the data source until permissions have been added which permit certain users or teams to query the data source.
							 
						 
					
						
							
								
									
										
										
										
											2018-10-31 02:02:12 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-05-21 03:48:52 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								**Required permissions**
							 
						 
					
						
							
								
									
										
										
										
											2021-09-29 23:45:27 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								See note in the [introduction ]({{< ref "#data-source-permissions-api" >}} ) for an explanation.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-01-11 21:52:33 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								| Action                        | Scope                                                                        |
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								| ----------------------------- | ---------------------------------------------------------------------------- |
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								| datasources.permissions:write | datasources:\*< br > datasources:id:\*< br > datasources:id:1 (single data source) |
							 
						 
					
						
							
								
									
										
										
										
											2021-09-29 23:45:27 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								### Examples
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-09-25 05:46:55 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								**Example request:**
							 
						 
					
						
							
								
									
										
										
										
											2018-10-31 02:02:12 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								```http
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								POST /api/datasources/1/enable-permissions
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Accept: application/json
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Content-Type: application/json
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-09-25 05:46:55 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								**Example response:**
							 
						 
					
						
							
								
									
										
										
										
											2018-10-31 02:02:12 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								```http
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								HTTP/1.1 200 OK
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Content-Type: application/json; charset=UTF-8
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Content-Length: 35
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{"message":"Datasource permissions enabled"}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-09-25 05:46:55 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								Status codes:
							 
						 
					
						
							
								
									
										
										
										
											2018-10-31 02:02:12 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								-  **200** - Ok
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								-  **400** - Permissions cannot be enabled, see response body for details
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								-  **401** - Unauthorized
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								-  **403** - Access denied
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								-  **404** - Datasource not found
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-09-20 06:04:56 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								## Disable permissions for a data source
 
							 
						 
					
						
							
								
									
										
										
										
											2018-10-31 02:02:12 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								`POST /api/datasources/:id/disable-permissions` 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-09-20 06:04:56 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								Disables permissions for the data source with the given `id` . All existing permissions will be removed and anyone will be able to query the data source.
							 
						 
					
						
							
								
									
										
										
										
											2018-10-31 02:02:12 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-05-21 03:48:52 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								**Required permissions**
							 
						 
					
						
							
								
									
										
										
										
											2021-09-29 23:45:27 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								See note in the [introduction ]({{< ref "#data-source-permissions-api" >}} ) for an explanation.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-01-11 21:52:33 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								| Action                        | Scope                                                                        |
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								| ----------------------------- | ---------------------------------------------------------------------------- |
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								| datasources.permissions:write | datasources:\*< br > datasources:id:\*< br > datasources:id:1 (single data source) |
							 
						 
					
						
							
								
									
										
										
										
											2021-09-29 23:45:27 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								### Examples
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-09-25 05:46:55 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								**Example request:**
							 
						 
					
						
							
								
									
										
										
										
											2018-10-31 02:02:12 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								```http
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								POST /api/datasources/1/disable-permissions
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Accept: application/json
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Content-Type: application/json
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-09-25 05:46:55 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								**Example response:**
							 
						 
					
						
							
								
									
										
										
										
											2018-10-31 02:02:12 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								```http
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								HTTP/1.1 200 OK
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Content-Type: application/json; charset=UTF-8
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Content-Length: 35
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{"message":"Datasource permissions disabled"}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-09-25 05:46:55 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								Status codes:
							 
						 
					
						
							
								
									
										
										
										
											2018-10-31 02:02:12 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								-  **200** - Ok
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								-  **400** - Permissions cannot be disabled, see response body for details
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								-  **401** - Unauthorized
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								-  **403** - Access denied
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								-  **404** - Datasource not found
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-09-20 06:04:56 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								## Get permissions for a data source
 
							 
						 
					
						
							
								
									
										
										
										
											2018-10-31 02:02:12 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								`GET /api/datasources/:id/permissions` 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-09-20 06:04:56 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								Gets all existing permissions for the data source with the given `id` .
							 
						 
					
						
							
								
									
										
										
										
											2018-10-31 02:02:12 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-05-21 03:48:52 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								**Required permissions**
							 
						 
					
						
							
								
									
										
										
										
											2021-09-29 23:45:27 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								See note in the [introduction ]({{< ref "#data-source-permissions-api" >}} ) for an explanation.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								| Action                       | Scope                                                                        |
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								| ---------------------------- | ---------------------------------------------------------------------------- |
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								| datasources.permissions:read | datasources:\*< br > datasources:id:\*< br > datasources:id:1 (single data source) |
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								### Examples
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-09-25 05:46:55 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								**Example request:**
							 
						 
					
						
							
								
									
										
										
										
											2018-10-31 02:02:12 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								```http
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								GET /api/datasources/1/permissions HTTP/1.1
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Accept: application/json
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Content-Type: application/json
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-09-25 05:46:55 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								**Example response:**
							 
						 
					
						
							
								
									
										
										
										
											2018-10-31 02:02:12 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								```http
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								HTTP/1.1 200 OK
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Content-Type: application/json; charset=UTF-8
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Content-Length: 551
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  "datasourceId": 1,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  "enabled": true,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  "permissions":
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  [
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "id": 1,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "datasourceId": 1,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "userId": 1,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "userLogin": "user",
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "userEmail": "user@test.com",
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "userAvatarUrl": "/avatar/46d229b033af06a191ff2267bca9ae56",
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "permission": 1,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "permissionName": "Query",
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "created": "2017-06-20T02:00:00+02:00",
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "updated": "2017-06-20T02:00:00+02:00",
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    },
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "id": 2,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "datasourceId": 1,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "teamId": 1,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "team": "A Team",
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "teamAvatarUrl": "/avatar/46d229b033af06a191ff2267bca9ae56",
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "permission": 1,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "permissionName": "Query",
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "created": "2017-06-20T02:00:00+02:00",
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      "updated": "2017-06-20T02:00:00+02:00",
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  ]
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-09-25 05:46:55 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								Status codes:
							 
						 
					
						
							
								
									
										
										
										
											2018-10-31 02:02:12 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								-  **200** - Ok
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								-  **401** - Unauthorized
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								-  **403** - Access denied
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								-  **404** - Datasource not found
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-09-20 06:04:56 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								## Add permission for a data source
 
							 
						 
					
						
							
								
									
										
										
										
											2018-10-31 02:02:12 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								`POST /api/datasources/:id/permissions` 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-09-20 06:04:56 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								Adds a user permission for the data source with the given `id` .
							 
						 
					
						
							
								
									
										
										
										
											2018-10-31 02:02:12 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-05-21 03:48:52 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								**Required permissions**
							 
						 
					
						
							
								
									
										
										
										
											2021-09-29 23:45:27 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								See note in the [introduction ]({{< ref "#data-source-permissions-api" >}} ) for an explanation.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-01-11 21:52:33 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								| Action                        | Scope                                                                        |
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								| ----------------------------- | ---------------------------------------------------------------------------- |
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								| datasources.permissions:write | datasources:\*< br > datasources:id:\*< br > datasources:id:1 (single data source) |
							 
						 
					
						
							
								
									
										
										
										
											2021-09-29 23:45:27 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								### Examples
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-09-25 05:46:55 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								**Example request:**
							 
						 
					
						
							
								
									
										
										
										
											2018-10-31 02:02:12 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								```http
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								POST /api/datasources/1/permissions
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Accept: application/json
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Content-Type: application/json
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  "userId": 1,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  "permission": 1
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-09-25 05:46:55 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								**Example response:**
							 
						 
					
						
							
								
									
										
										
										
											2018-10-31 02:02:12 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								```http
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								HTTP/1.1 200 OK
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Content-Type: application/json; charset=UTF-8
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Content-Length: 35
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{"message":"Datasource permission added"}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-09-20 06:04:56 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								Adds a team permission for the data source with the given `id` .
							 
						 
					
						
							
								
									
										
										
										
											2018-10-31 02:02:12 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-09-25 05:46:55 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								**Example request:**
							 
						 
					
						
							
								
									
										
										
										
											2018-10-31 02:02:12 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								```http
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								POST /api/datasources/1/permissions
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Accept: application/json
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Content-Type: application/json
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  "teamId": 1,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  "permission": 1
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-09-25 05:46:55 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								**Example response:**
							 
						 
					
						
							
								
									
										
										
										
											2018-10-31 02:02:12 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								```http
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								HTTP/1.1 200 OK
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Content-Type: application/json; charset=UTF-8
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Content-Length: 35
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{"message":"Datasource permission added"}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-09-25 05:46:55 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								Status codes:
							 
						 
					
						
							
								
									
										
										
										
											2018-10-31 02:02:12 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								-  **200** - Ok
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								-  **400** - Permission cannot be added, see response body for details
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								-  **401** - Unauthorized
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								-  **403** - Access denied
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								-  **404** - Datasource not found
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-09-20 06:04:56 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								## Remove permission for a data source
 
							 
						 
					
						
							
								
									
										
										
										
											2018-10-31 02:02:12 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								`DELETE /api/datasources/:id/permissions/:permissionId` 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-09-20 06:04:56 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								Removes the permission with the given `permissionId`  for the data source with the given `id` .
							 
						 
					
						
							
								
									
										
										
										
											2018-10-31 02:02:12 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-05-21 03:48:52 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								**Required permissions**
							 
						 
					
						
							
								
									
										
										
										
											2021-09-29 23:45:27 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								See note in the [introduction ]({{< ref "#data-source-permissions-api" >}} ) for an explanation.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-01-11 21:52:33 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								| Action                        | Scope                                                                        |
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								| ----------------------------- | ---------------------------------------------------------------------------- |
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								| datasources.permissions:write | datasources:\*< br > datasources:id:\*< br > datasources:id:1 (single data source) |
							 
						 
					
						
							
								
									
										
										
										
											2021-09-29 23:45:27 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								### Examples
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-09-25 05:46:55 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								**Example request:**
							 
						 
					
						
							
								
									
										
										
										
											2018-10-31 02:02:12 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								```http
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								DELETE /api/datasources/1/permissions/2
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Accept: application/json
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Content-Type: application/json
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-09-25 05:46:55 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								**Example response:**
							 
						 
					
						
							
								
									
										
										
										
											2018-10-31 02:02:12 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								```http
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								HTTP/1.1 200 OK
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Content-Type: application/json; charset=UTF-8
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Content-Length: 35
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{"message":"Datasource permission removed"}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-09-25 05:46:55 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								Status codes:
							 
						 
					
						
							
								
									
										
										
										
											2018-10-31 02:02:12 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								-  **200** - Ok
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								-  **401** - Unauthorized
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								-  **403** - Access denied
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								-  **404** - Datasource not found or permission not found