user3889825
user3889825

Reputation:

Call an external API into a Ruby on Rails Application

I am using a Clear bit gem. How do I call the external API in the Rails application and send data back forth without the default database to store data.I need to build a form like the Clear bit form and send data back and forth.Do I need a controller and model for the same?

Upvotes: 0

Views: 4267

Answers (1)

Roc Khalil
Roc Khalil

Reputation: 1385

To call any external url, you should require rest-client gem.

url = "https://...."
body = RestClient.get(url)
JSON.parse(body)

You have to check the rest-client documentation

Upvotes: 6

Related Questions