1 of 7

API

Application Programming Interface

DKDK - October 28, 2024

2 of 7

First an example:

  • Morse code and telegraph machines have an agreed upon format in advance. Namely:
    • letters are made up of combinations of dots and dashes.
    • a dot lasts for one second.
    • a dash last for three seconds.
    • the space between dots and dashes is one second.
    • the space between different letters is three seconds.
    • the space between different words is seven seconds.

  • These rules provide a format that can be used by anyone to interpret a morse code message.

3 of 7

An API is similar to Morse Code

  • An Application Programming Interface (API) broadly is just like a code of communication between two computer programs.

  • Each program has to know in advance what to expect and how to interpret what it receives.

  • Almost all computer programs do

this, very few programs are

completely isolated from start to

finish.

4 of 7

Have I ever used an API?

Almost all of you have used APIs whether you knew it or not

  • Google Maps API, used in a number of web applications either as an embedded map, or for map querying.
  • GitHub API, used by many programmers to automate tasks and manage repositories.
  • CSE 12X, the various Java data structures you’re using (Stacks, Lists, Maps etc.) have APIs detailing the way the user can interact with them.
  • Later on you will get to define your own objects and ways of interacting with them.

Any time one of your programs communicates with another program you’re using an API

PSE Outage Map using Google Maps

5 of 7

More examples of APIs

APIs are all around us. Good APIs allow different programs to mesh together seamlessly.

Social Media APIs:

  • Twitter API: Allows access to data like tweets, user profiles, and trends. Supports posting tweets, retweeting, and liking tweets.
  • Instagram Graph API: For retrieving media, insights, and engagement metrics. Commonly used for social media analytics tools.

Communication APIs:

  • Slack API: Integrates with Slack to automate message posting, retrieve channel information, manage users, and customize workspaces.
  • Zoom API: Supports scheduling, managing, and retrieving information about meetings, participants, and webinars.

Other types of APIs:

  • “Log in with Google, LinkedIn, etc” on websites
  • Computer Operating Systems
  • Advertisements on websites

Overkill login page

6 of 7

API design is crucial

When you think about it designing systems that can interface with each other is at the heart of what we do as computer scientists.

  • We seek to make abstractions
  • APIs allow us to communicate to a program what we want it to do, without worrying about the details.
  • We want to make our programs easy to use.
  • We want to automate tasks.

7 of 7

DKDK Voting!