Working With APIs

      Drop me a line  -

      Got questions?

                                fabio@bitmaker.co

INTRO // Goal

By the end of this lesson, our goals are to a) be able to use a simple API within a web application, and b)...

INTRO // Goal

To understand how to build an API for others to use.

What is an API?

INTRO

  • An API stands for an Application Programming Interface

  • The "interface" is just a set of instructions for us to be able to use a software application programmatically (ironically - without a visual interface!)

  • An API can give us access to one or more of the CRUD operations

  • Examples would be: accessing a set of tweets to do our own analysis, retrieving sports data to build a playoff pool application, or creating Facebook posts via an app that we build ourselves

  • We should always look for and use APIs rather than "scraping" for data when possible

INTRO

  • Some APIs will be free, while others may cost money to access

  • Some APIs may not require any sort of authentication and let anyone use the application, while others will require a token or login so they know who is using the API

  • Many APIs will have restrictions on how they are used and how often they can be used (some may restrict based on the number of requests, while others may restrict based on the amount of data your requests return)

  • Some APIs, such as Twitter, Facebook or LinkedIn allow developers to use their APIs on behalf of users. To do this, you will need to get your application's user to authorize your application to use the API on their behalf. This is usually done via OAuth which will be covered in depth another lesson.

INTRO

  • There are 2 general types of APIs that are used most often in web applications: REST APIs and SOAP APIs.

  • REST APIs are becoming more and more common, as they are much easier to use, and almost always return JSON. Examples of popular REST APIs are Twitter or Facebook.

  • SOAP APIs are usually used in legacy or enterprise environments. They are harder to use, and require data (requests and responses) to be exchanged via XML. Many .NET or Java based applications still use SOAP APIs.

  • Whenever possible, we will want to use (or build) REST APIs.

Requests and Responses

INTRO

Let's get started!

Building Our Own API

APIs

Considerations

Building APIs

  • Why would we want to have an API? (What is our use case?)

  • Do we need someone to authenticate?

  • Do we want to track who is using our API?

  • If we release it into the wild, and developers are building applications using our API, what happens when we change things or update it?

APIs

By Bitmaker

APIs

Intro to HTML & CSS Workshop /// Bitmaker (Mina)

  • 836