Send user name as part of ajax get request

Hello,

I have custom python scripts running in a back-end server based on information sent periodically from Grafana ajax GET request.

As part of the request sent I would like to include the name of the current user viewing the Dashboard.

Is this possible ? What is the synthax of the API the would allow me to do so ? (I have read the docs but not been able to send username)

Thanks,

Emilien

I’m doing something similar, I’ve deployed grafana and the Backend behind a reverse proxy.

/grafana/backend -> backend
/grafana -> grafana

This way the backend receives the grafana session cookie with which the backend can query the grafana api to get the username of the session

1 Like

Hello,

Thanks, what about this :slight_smile:

Only available in Grafana v7.1+

${__user.id} is the ID of the current user. ${__user.login} is the login handle of the current user.

Source : Add and manage variables | Grafana documentation

Sure, this might work with the Ajax panel. But in my case I’m doing scripted dashboards, where the backend is generating the Dashboards on the fly.