Understanding API Consumption using net/http

I am new to Ruby on Rails and I am trying to consume a RESTful API on my app. I cannot seem to have a work around on how to pass data dynamically from the API to my app.
I am using the net/http api client.
What steps or resources should I use to learn more about working with APIs in Ruby?

This page has documentation on getting started and should be able to walk you through making get requests with the http gem

1 Like

That is a very generic question.

The flow is usually like, make your request with net/http, parse your response and do something with it (persist in your DB or do something on your models, etc).

You can also use some gems like http_party or faraday to make your interaction less painful. There is a nice article here :


In general I would start with some curl requests, translate them to net/http or http_party, then when the API is complete, refactor to dry up the code a bit.

1 Like