Background

In case you are not aware, HTTPoison is a http client library for Elixir (Like requests in python) I need to pass an auth_token as a query param for every API call.

Unfortunately, (as of april 2020) the documentation was not clear enough.

Documentation of this function redirects to HTTPoison.Request which does mention :params as

:params - Query parameters as a map, keyword, or orddict

Even the example uses only first 4 of the 5 parameters 😀

Google search also did not help much, until I stumbled upon this line in one of the HTTPoison's PR which I found via one of the searches.

Solution

Send in params as part of options like :

1
2
3
4
5
6
7
8
9

options = [params: [access_token: "my_access_token"]]
HTTPoison.request(
        method,
        url,
        body,
        headers,
        options
      )