Using API's on Rails (Is Java script necessary?)

Hi all,

I’ve started learning Ruby and I’m still learning the basics.

My goal is to create web applications using rails and multiple API’s (API mashup… Google, FB, Twitter,etc…)

I see most people coding in Java script when communicating with API’s and I have 2 questions.

  1. Is learning java script the only option to communicate with API’s?

  2. If yes, do I need to learn entire java script? or just learning small basic portion will still do the work?

I have no “real coding experience” but have pretty good understanding about how the web works under the hood.

Thanks in advance :slight_smile:

E

It depends: if these are server side apis (i.e. called from your rails app) then no, if they are client side ones (the api call is made by the user’s browser) then yes. It’s not really possible to escape javascript if you’re developing for the web (setting to one side languages that are transpiled to javascript). As always there is a distinction between a language and the frameworks, libraries and ecosystem built on top of it - Javascript itself is not that big or complicated and you do need to understand pretty much all of it, but you don’t need to learn ember, react, etc. if you don’t want to.

Fred

Nojin Park <hourglassxe@gmail.com> writes:

Hi all,

I've started learning Ruby and I'm still learning the basics. My goal is to create web applications using rails and multiple API's (API mashup.. Google, FB, Twitter,etc...)

Welcome!

I see most people coding in Java script when communicating with API's and I have 2 questions.

1. Is learning java script the only option to communicate with API's? 2. If yes, do I need to learn entire java script? or just learning small basic portion will still do the work?

I have no "real coding experience" but have pretty good understanding about how the web works under the hood. Thanks in advance :slight_smile:

E

The answer to this is, to my mind, you code in the language of your application. If you application is written in JS, you write in JS; as your application is written using Rails, you write in Ruby.

What's possibly confusing the issue is that many public APIs as you have listed transmit responses in JSON, which is a JS object. However, every language used to communicate with web services has the ability to understand that, including Ruby.

In addition, Rails has a tonne of contributed gems to interface with the popular web services.

That said, you'll still probably need to learn some JS along the way anyway because it's pretty much expected your own application front end will need to use some.

Take it slow, learn in stages; there's a lot to learn and you should expect it to take some time.