Core Interaction Spring 2018

Getting Started

  1. Make an account with Open Weather Map to get an API key

  2. Download and install JSON Formatter for Google Chrome

About JSON API’s

API is the acronym for Application Programming Interface, which is a software intermediary that allows two applications to talk to each other. Each time you use an app like Facebook, send an instant message, or check the weather on your phone, you’re using an API.

Query Strings

Information from a JSON API is usually accessed via a URL Query String. This is a method of adding search terms to a URL.

A query String for an imaginary API that hosts a database of turtles may look something like this:

This is the query string from that URL:


You can tell it’s a query string because it starts with a ? mark and has &’s separating values. Here, we are looking in our turtle database for information regarding a specific turtle. These are our parameters:

Accessing Weather Data

Here is a real world example of an API request to Open Weather Map. Try it out, copy and paste the following URL in your browser and see what you get. This requires an authenticated request so just remember to replace {yourApiKey} with your actual API key.{yourApiKey}

Here, we are asking for information about the current weather in the are. These are our parameters:

You should get some JSON back in response. Now it’s time to work with that JSON. Once parsed it will behave just like any other object in Javascript. We will use a Fetch Request in Javascript to get the data:

// Insert your actual API request URL below
    .then(function(response) {
        // Get the response and format it to JSON
        return response.json();
    .then(function(jsonData) {
        // log the data

API Resources

General Resources

Example API’s