# Working with APIs

An API is an Application Programming Interface. This term describes some type of service that you can communicate with programmatically.

The Application is a collection of scripts and data. The application can be written in any programming language. The data can be stored in any type of database or any data format.

The Interface part is a list of methods and properties which can be accessed externally. Inside the application there are private properties and methods which cannot be accessed. The purpose of this is to protect the data by controlling access to the data.

As we are working with websites and mobile apps, the APIs that we generally work with are web APIs.

There are many publicly available APIs.

Sample JSON data for practicing and testing code

DarkSky is a public weather API. This is the public website - which uses the API. Here is the developer site where you can sign up to access the weather data through the API - https://darksky.net/dev/

Rotten Tomatoes has an API - http://developer.rottentomatoes.com/docs and closely related to that is The Movie DataBase API.

Flickr, the public image sharing site, has a public API - https://www.flickr.com/services/api/

Imgur, another public image sharing site, has a public API - https://api.imgur.com/endpoints

Google has lots of public APIs like the Google Maps API and the YouTube API.

Twitter has an API - https://dev.twitter.com/.

Facebook has an API - https://developers.facebook.com/.

Yelp has an API - https://www.yelp.com/developers/getting_started.

SoundCloud has an API - https://developers.soundcloud.com/.

NASA has a Picture of the Day API. Start here to register for an API key https://api.nasa.gov/

And here is a list of public apis https://github.com/toddmotto/public-apis This is an external link. and another list of popular APIs - http://www.programmableweb.com/apis/directory.

As you can see there are many many APIs that you can use to fetch data for your apps.

# Bringing It All Together

Once you have your AJAX fetch( ) calls to the API of your choice working and you want to bring the data back and display some HTML then you need to be comfortable with the fetch( ) method as well as all the DOM methods for manipulating web pages.

Here is an example video showing how to turn JSON data from the jsonplaceholder into actual HTML in a web page.

Back to Week main page

Last Updated: 11/1/2020, 2:32:17 PM