Create a user and provide permission to only specific dashboard using api

Hello community,
This topic maybe already has an answer but i can’t find it, I’m trying to create a user and provide access to only specific dashboard. For now I’m able to create user but not succeed to provide access to only specific dashboard. Below line of code I’m using to create user.

curl -XPOST -H "Content-Type: application/json" -d '{
  "name":"User",
  "email":"user@graf.com",
  "login":"user",
  "password":"userpassword"
}' http://admin:admin@localhost:3000/api/admin/users

also using python script for the same

import requests
import json

grafana_url = "localhost:3000"
username = "admin"
password = "admin"

base_url = "http://{}:{}@{}".format(username, password, grafana_url)

data = {
  "name":"Viewer",
  "email":"viewer@xxxxxx.com",
  "login":"viewer",
  "password":"viewer@123",
  "OrgId": 1

}


resp = requests.post(base_url + "/api/admin/users", json=data, verify=False)
data = resp.json()
data

It will be very helpful to find solution for this.

1 Like

+1, anybody?