Skip to content

Missing URL encoding for several API endpoint parameters #247

@MatthiasLohr

Description

@MatthiasLohr

Describe the bug
The API contains several API calls, e.g. user.find_user(login_or_email), which pass given parameters plain to the API, which can lead to problems if non-URL-safe characters are used. For example, passing an email address like test+2@example.com to user.find_user(login_or_email) results in the API call with URL /users/lookup?loginOrEmail=test+2@example.com, whereby the server interpretes the + as space.

To Reproduce
Steps to reproduce the behavior:

  1. Create a user with an email address containing a +, e.g., test+2@example.com via the GUI.
  2. Run API call user.find_user(login_or_email="test+2@example.com").
  3. The user will not be returned (grafana_client.client.GrafanaClientError: Client Error 404: user not found).

Expected behavior
A JSON response with the data of the user with that email address.

Versions

  • Grafana: 12.3.1
  • grafana-client: 5.0.1
  • Authentication: [Basic]

Additional context
There are also other API calls missing encoding, such as user.search_users.

I would also offer to provide a Pull Request to fix this, if this is wanted by the project leads.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions