Star/Unstar users dashboards from admin user via API

Hello,

I expose my case:
1 - Login with admin user via Basic Auth
2 - Switch to a Viewer user using:
http://docs.grafana.org/http_api/user/#switch-user-context-for-a-specified-user
curl -H “Authorization: Basic ZGVtbzpkZW1v” -X POST “http://monitor.demo.com/api/users/30/using/37
Response: {“message”:“Active organization changed”}
3 - Star/Unstar dashboard
http://docs.grafana.org/http_api/user/#star-a-dashboard
curl -H “Authorization: Basic ZGVtbzpkZW1v” -X POST “http://monitor.okitup.net:3000/api/user/stars/dashboard/51
{“message”:“Dashboard starred!”}

The problem:
I thought that switching user by user_id = 30 (viewer) it will star/unstar dashboards for that user.
But this is working for the admin user.

Admin and Viewer users belong to the same organization.

I use it to star a dashboard and then change the preferences to set a HomeDashboard.
I want to do it without login as the viewer user.

Thanks!

1 Like

Hi
After star dashboard, You must go to “Org Preferences” and Select this dashboard in “Preferences/HomeDashboard”.

Hi,
Thanks, yes I know that, but my problem is another.
I want to do that via API with an admin user that is a different user of the starred dashboard.

My intention is manage a lot of viewer users with only one admin user via API.
I tried to switch user to emulate a viewer user, but when I do that the star is not for the viewer user. Is the admin user who gives the star…

So I don’t understand the purpose of that API command:
http://docs.grafana.org/http_api/user/#switch-user-context-for-a-specified-user

1 Like