API for granting Team Member Admin Permission

  • What Grafana version and what operating system are you using?

Docker, grafana/grafana:9.4.3-ubuntu.

  • What are you trying to achieve?

Grant a user Admin privileges on a given team via the API.

  • How are you trying to achieve it?

The swagger docs mention the following API Call that “should” work.

curl -X PUT -u "admin:admin" -d '{ "permission": 4 }'  http://grafana.staged-by-discourse.com/api/teams/9/members/2

That responds back with a:

{"message":"bad request data","traceID":""}                                                 

I also tried to invoke the same call as the UI does

curl -X PATCH -u "admin:admin" -d '{"role":"Admin"}'  http://grafana.staged-by-discourse.com/api/org/users/5
{"message":"bad request data","traceID":""}

The traceID, I assume is something the UI generates and is an internal API only intended to be called from the UI. How would one grant a team member admin permission via the API? Is that not supported?

  • What happened?

Error response mentioned above is returned.

  • What did you expect to happen?

The user be granted admin privileges for the given team.

  • Can you copy/paste the configuration(s) that you are having problems with?

N/A

  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.

Not using the UI, so no.

  • Did you follow any online instructions? If so, what is the URL?

NA

in body give json format
also check instead of text give JSON

Thanks. I thought I had tried all kinds of variation. Setting the Content-Type fixed the issued for the PUT update.

I do wish the “AddTeamMember” would allow all of this to happen in one call. There’s no reason to make one call to add a team member and another to elevate his privileges.

Thank you for solving my issue!