Make HTTP request with Elixir and Phoenix

With httpoison (HTTP Client) and poison (JSON Encoder/Decoder) packages, this is almost as simple as your code which uses HTTParty:

url = "{api_key}"

response = HTTPoison.get!(url)
req = Poison.decode!(response.body)

Not only can you write your code as simply as before as shown in @Dogbert's example, but you can do cool things with pattern matching, too (and be as granular as you like)

Using HTTPoison and Poison, as well:

url = "{api_key}"

case HTTPoison.get(url) do
  {:ok, %{status_code: 200, body: body}} ->

  {:ok, %{status_code: 404}} ->
    # do something with a 404

  {:error, %{reason: reason}} ->
    # do something with an error