jace

jace

What HTTP client library to start with as a Elixir beginner?

I wanted to write a library for interacting with a Web API as a practical way of learning Elixir. However, there seem to be a lot of different open source HTTP client libraries I can use! I am unsure what to use to start off with. I do want to use something basic so that I learn as much as possible while working on my project.

I noticed the Tesla library but I was wondering if anyone has any other lower level recommendations.

Most Liked

sergio

sergio

I recommend Req. Has a ton of concise out of the box defaults, you generally don’t worry about the minutiae. It retries etc, all configurable but all with great defaults for your 99% cases.

Example:

Req.get!(req_url,
  headers: [
    {"user-agent",
     "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36"}
  ]
).body
thojanssens1

thojanssens1

I would recommend Finch, which is a layer on top of Mint. They are both fully written in Elixir, but I feel Mint is too low level if you want an easy to use API.

dimitarvp

dimitarvp

finch is pretty nice and allows you good control and branching on responses. It strikes a good balance between control and brevity IMO.

Many people started using req lately. I checked it out quickly and liked what I saw, though never tried it personally.

That being said, nowadays I’d use Tesla and pick an underlying HTTP client for it, which would be Finch. I simply like having the same dev experience everywhere where HTTP client is needed. Though that’s not an accepted fact, just my own preference.

Where Next?

Popular in Chat/Questions Top

nur
https://e.planaria.network/stack.png https://e.planaria.network Build a NoSQL DB, Build a Relational SQL Database, Build a Graph Datab...
New
markdev
What are the best beginner resources for learning Elixir and OTP (not Phoenix) in 2018?
New
mchean
I was wondering if anyone is using some learning tools that they can recommend? I’ve been looking at two specifically so would also be ...
New
tom_s
Hello Elixir Community! I’m new to functional programming in general and to Elixir in particular but I’m very intrigued and would like t...
New
jslearner
Will learning Erlang really help in being a better Phoenix or Elixir developer or is it a waste of time?
New
Besto
I've been trying to start learning Elixir for a couple of weeks while I develop a tiny project I have on node.js, but every time I try to...
New
ericmachine88
Hi all, I am currently on this course Half a way thru, and struggled a bit… sometimes I don’t even know what I am coding especially ...
New
AstonJ
It’s been a while since we asked this - I’m sure others (especially newcomers to the language) will be interested to hear how you’ve all ...
New
Allyedge
So, I want to get an Elixir book, but don’t know which one to get. Both Programming Elixir 1.6 and Elixir in Action looks interesting, b...
New
shansiddiqui94
Greetings Elixir Developers, My name is Daniel, and I am taking my first step to learn all about the Elixir language. Currently I have a...
New

Other popular topics Top

sergio
In Ruby, I can go: User.find_by(email: "foobar@email.com").update(email: "hello@email.com") How can I do something similar in Elixir? ...
New
_russellb
I want to try my hand at web scraping. What tools/libraries do I need to use. I’m hoping to turn this into something professional so don’...
New
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod -- where is this set? Thanks.
New
Jim
As a follow up to my earlier question: I have the code compiling and running but not getting a successful login from the rest server. ...
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
mgjohns61585
Could someone help me? I'm making my first elixir program, number guessing game. I can't figure out how to convert the user's guess from ...
New
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New

We're in Beta

About us Mission Statement