ProstDev ProstDev

What is an API? | Understanding APIs (Part 1)

Thumbnail: What is an API? | Understanding APIs (Part 1)
Watch on YouTube

About this video

A from-scratch explanation of what an API is: the implementation (the body), the request and response, and the four aspects every API has — inputs, operations, outputs, and data types — wrapped up with a simple diagram you can refer back to.

Resources

Transcript

Intro

So you’re here because you want to learn more about APIs. Well, in this series of videos I will explain what APIs are right from the beginning. My name is Alex Martinez — you can call me Alex. Get comfortable and let’s get started.

API

Okay, so first of all, what does API mean? API means Application Programming Interface. And that doesn’t tell you anything, so let’s continue.

Implementation

What is the implementation? The implementation is the body of the API, and this implementation can contain different programming languages. It can be made out of Java, PHP, Python, or MuleSoft.

Request/Response

So this implementation — how do you call it, or how do you interact with it? Well, you have the implementation, and then you send something into the implementation, or the body of the API, and the API (or the implementation) will return something to you. You say, “Hey API, what’s up?” and the API responds, “I’m good.” These two little things are called the request and the response, because you request something to the API and you get a response back from the API.

Aspects

Now, an API can have four different parts or aspects to it. It has inputs, operations, outputs, and data types. So what are these things?

Inputs

First we have the inputs. The inputs basically have data or information that we’re sending into the API. This is just the first handshake that we do to call the API. We also send the operations into the request.

Operations

The operations basically tell the API what we want the API to do with the data that we’re sending in the input.

Outputs

Next we have the outputs, which are part of the response. In the response, the API will give us back some data, and this data is the outputs. So you send data with the inputs, and along with some operations I will tell the API exactly what to do with those inputs and what we need to receive from the outputs, or the response of the API.

Data Types

We also have data types. Data types can be numbers, words, files, formats — in this case I put here some examples like CSV, JSON, and XML. If you’re familiar with these terms, cool; if not, don’t worry about it.

Let’s just say that if you send numbers in the input, you may receive numbers in the output. But also, let’s say that you send some numbers in the input and you want to receive words, or strings, in the output. Those are different data types. You can have the same data types in the input or in the output, or even in the implementation itself.

Remember how we just said that the implementation can be made out of different programming languages? If all of the implementation was created in Java, then most likely all of the data types that will be used inside of the implementation will be Java objects, Java arrays, collections, strings, booleans — all of that fun stuff.

Recap

And that’s it. So, just a quick recap on the beautiful diagram that we just created: we have the implementation, we have a request, and we have a response. We send the request into the implementation (or the body of the API), and we receive a response back from it. In the request that we send into the API, we put inputs and operations — this is basically to tell the API (or the implementation) what to do with the data that we’re sending. After the API processes all of this information, it will give us back an output, and remember that the outputs also have data types.

So this is just Part 1 of the Understanding APIs series. For now, it’s just important that you understand the different aspects or parts that an API can have: request, response, inputs, outputs, operations, and data types. That’s all you need to understand for now.

Ending

So if you want the written version, remember to go to prostdev.com and check out the Understanding APIs post series. Again, my name is Alex Martinez — you can call me Alex. I hope this was fun, and see you in the next video.

More from Other MuleSoft videos

Search

Loading search…