Resources for learning APIs

Resources for learning APIs
0

#1

So I’ve gotten through the Quote project and am working through the weather project now.

In both instances I’ve gotten the API URLs to work (once they are working the projects come together pretty easily and are fun), but not without looking up tutorials first. I’m having a lot of trouble figuring out how to make the URLs from reading just the official api documentation.

Can anyone recommend some tutorials / videos for APIs and their URLs / $.getJSON / $.ajax in general? I don’t want to depend on tutorials specifically for each API i find myself using and would love to be able to figure out how to get them to work on my own.

Thanks in advance!


#2

For testing APIs, the Chrome App Postman is excellent. You can experiment away.


#4

Thank you ill check it out!!


#5

awesome thanks for the resources, I’ll check it out!

Mainly I get what to do with the API and sort of how it works, it getting me back an object I can manipulate… but when it comes to the URL and stuff, I try to look through the api documentation to try to build my url query string but get tooootally lost


#6

Third recommendation for Postman. Also:

  1. the Udacity course on AJAX/APIs helped me a lot. Though if you’re already done with the quote project you might have already gotten most of what it helped me with.
  2. every API is different. The opening stages of a project have a lot to do with figuring out how this one works, how it wants you to treat it, and what it can give back. The weather app has a lot of issues depending on which API you choose. The Wikipedia API turns out to be about 200 different APIs that do different things and accept different parameters. The Twitch app, as well, requires more steps than one might assume.
  3. as p1xt said, the API is just the beginning. In a more complicated app, you'll find a lot of the work to be done is just figuring out its internal mechanics, the Rube Goldberg machine that makes the data show up over there, which makes that other thing do that, and then when you click that it does that with the data and also makes the first thing do that thing.

    #7

    I found
    this set of videos
    very helpful for learning JSON basics, he uses a framework but the core concepts are the same and he’s a great teacher!


    #8

    I end up making dozens (hundreds) of error-prone, unnecessary requests to some API during development.

    It seems to me that for common public open APIs such as the reccommended one for the weather app project:

    We recommend using the Open Weather API. This will require creating a free API key.

    there could be a tool for just testing http requests
    > Is this what you use postman for?
    Ideally it would simulate a call in order to:

    • not waste API key quotas
    • prevent timeouts, 404 not found etc…
      specifically from overuse of an api but still receive some data to manipulate.

    I have looked at swagger:
    So far I know:

    • that it is a specification for REST apis (i.e: a set of rules that APIs could follow)
    • there are a bunch of related online tools (mostly for documenting, testing)

    What do you all make of all that? It seems to me the emerging standard for APIs to follow.

    How do you all test APIs that you consume?


    #9

    Sorry to answer my own question, but I’ve just thought of something that was perhaps obvious, but worth sharing as a good idea.

    I’m in the middle of debugging my implementation of an ajax request with chrome dev tools.
    It was simple, I prepared a variable (using jquery btw)
    var dummyresponse;
    and in the ajax call I simply saved the response

    success: function(response) {
    dummyResponse = response;
    }

    now the response is held in memory for me to investigate at leisure. Literally typing commands into dev tools (mostly console.log)

    found about 5 mistakes already with one ajax call! :smiley: