4 ms·
Possibly slightly tangential. I am someone that has a basic understanding of JS. I don't code on a regular basis, just here and there. I'm fine with html and cs
by krmmalik 12y ago
Possibly slightly tangential. I am someone that has a basic understanding of JS. I don't code on a regular basis, just here and there. I'm fine with html and css, but I want to up my JS skills in a couple of specific areas. Specifically, I want to learn how to build apps that can leverage other APIs. say for example if I want to build a service that interacts with the gmail api. I can't seem to find any information anywhere that can help me do this. Every time I do a search for JS API, API, rest API or similar, all I get is results for how to build an API in your own app, which is not what I need.
Does your book have the content I need to learn how to use an API?
If not -- does anyone have any suggestions as to where I can go to learn this?
- delluminatus 12y agoThere is a beta Javascript client library for the Gmail API [0]. If you are looking to interface with an API that doesn't provide a JS client, your best bet might be to just build yourself a simple client using jQuery to handle the HTTP communication (see, for example, jQuery.ajax [1] for making HTTP calls). ETA: To elaborate a bit, "interfacing with an external API" is usually just a fancy way of saying, "making HTTP requests." In Javascript, this means using the XmlHttpRequest browser API, which people call AJAX because it sounds hip. You can use it directly, but jQuery gives some extremely convenient helper methods for easily composing requests. One thing to keep in mind is that if the API uses JSON, you will have to consider that the browser does not permit you to return JSON from a cross-domain request (which an external API call almost certainly is). There is a way to enable this using something called JSONP [2]. [0]: https://developers.google.com/api-client-library/javascript/start/start-js https://developers.google.com/api-client-library/javascript/... [1]: https://api.jquery.com/jQuery.ajax/ https://api.jquery.com/jQuery.ajax/ [2]: http://json-p.org/ http://json-p.org/
- mrschwabe 12y agoHenrik's book here can definitely help you. But just to add my 2 cents for working with API's specifically - on the server side - a good start might be to play around with Node and CouchDB. Try building a basic app. Couch is a database with an HTTP API out of the box, so if you can get the hang of it's basic operations then you will inherently have the fundamental knowledge needed to work with just about any other API.