🦄How to deploy your own API? - Part 1
Tags: productivity, beginners, api, devops
Published: 2021-04-26 16:16:17

> Tired of having a static frontend with no way to share your data between applications? Why not build your own free API backend!

**In this [blogpost series](https://dev.to/lucianojung/series/12318) I want to give you a basic understanding of APIs, show you what information you need to use an API and what alternatives to APIs are available.** In the next part I want to demonstrate how you can create a simple API using Spring Boot and Heroku. The last part of the series will show you how to use Flutter to access your API and process the data at runtime. 
[Follow me](https://dev.to/lucianojung) to not miss any following posts.

## Content
<ul>
    <li><a href="#what-is-an-api">What is an API?</a></li>
    <li><a href="#what-are-the-benefits-of-apis">What are the benefits of APIs?</a></li>
    <li><a href="#what-do-you-need-to-know-about-an-api-to-use-it">What do you need to know about an API to use it?</a></li>
    <li><a href="#bonus-what-are-alternatives-to-apis">Bonus</a></li>
</ul>

![iconfinder_485_book_pen_food_education_4212930](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zus631fia04c9o55r89k.png)
 
## What is an API?
API (long for Application Programming Interface) is an interface that allows data to be exchanged between multiple applications. It allows systems to communicate with each other and collect data that other systems have generated or collected themselves.

So basically, APIs are back-end applications hosted on servers with public (usually encrypted) interfaces. If you have permission to access them, you can usually communicate with them over an Internet connection and receive data for further processing. It is important to know that you're not receive just the whole database behind the API, when you access it, rather than already processed data without gaining access to sensitive information, the application didn't want you to see.

![iconfinder_481_university_bank_campus_court_4212926](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tqvwik0cavzx47ebmnc6.png)
 
## What are the benefits of APIs?
In a nutshell, external APIs can increase the productivity of your systems and analytical results with less cost and time consumption by serving massive data. While APIs you create improve connectivity and collaboration with other software systems to get better and more reliable applications.
**If you are a beginner, it's good to build your own API so that you understand the structure of an API and how to deal with them.**

![iconfinder_496_bulb_energy_idea_solution_4212938](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lyhaenoauith24kwt3mp.png)

## What do you need to know about an API to use it?
If you want to get started with an API, you need to know the following:
### 1. What base URL do I need to call to access an API?
The base URL tells you how to test the API and where to access it in production. 
-> For example: https://api.myService.com/
Modern APIs also use versioning so that an application doesn't have to choose between crashing or updating when the API is updated.
-> For example: https://api.myService.com/version_2/

### 2. What encryption method does the API use?
If you can access the API without an access key: **Great, skip this point!**
If not, find out what authentication method the API uses and what security schemes you can use to access it. Many APIs allow you to access with more than one security scheme.
Most APIs use **TLS encryption** or **WS Security** as the authentication method.
Common security schemes include **access tokens**, **id-key authentications**, or **OpenID Connect**.
Sometimes you just need to create an account to get an access token.

### 3. What data format will I receive in response?
To process the response, you first need to know what data format you will receive as a response. Common data types are:

- json
- xml
- yaml
- csv

Most of them have the key-value principle: they have a static key (e.g. name) and a dynamic value (e.g. dev-reader):
*name: dev-reader*
So it is important for you to understand the object structure. If you do, you can easily retrieve the value every time you access the API by simply knowing the key.
Sometimes you have plain text as the data format. I don't know what's going on with developers issuing plain text to users, but most of the time they have a structure that you have to figure out.

![iconfinder_516_pedestal_first__first_place_education_4212898](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cnz1wk16j5de13qgmo4j.png)
 
## BONUS: What are alternatives to APIs?
While there is hype around APIs and I recommend every full-stack developer look into it, there are of course alternatives to using APIs:

### 1. Manual download
When a company publishes a document and you want the information in it, you simply download it. However, it's easy to see that this method is quite heavy when dealing with large data sets and you have to manually update the data every time.

### 2. website crawling
If a company don't want to create an API you can get your data by crawling through their websites programmatically. However, without the consent of the website owner, it is not suitable to simply crawl his website. If crawling happens regularly, the website operator can take action against it and protect certain crawlers or entire areas against crawling.

### 3. Restricted database access
If you want to cooperate with a company but they didn't provide an API you can ask them for a restricted database access. While this is a better solution than the previous ones when it comes to rapidly changing data sets, it does require some effort to set up.

### 4. Don't append on external data
It's easy to say but some applications don't need external data. And because of that they don't need APIs. It's not advisable for every system to use APIs. 
**If you still need external data for your application APIs are recommended in most cases!**

![iconfinder_478_cloud_arrow_book_notebook_4212923](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kpwwlwtc4rc1ck912i2b.png)
## Comments
What are your experiences with API Services? 
How do you want to use an API Service?
What do you think is the 🦄-Icon in the Header for?
**Let me know in the comments below!**


![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0wtpvq02mzobtz4lx46j.png)
With the knowledge you gained in this post i want to build and deploy a simple api in the next parts of this series.

[Follow me](https://dev.to/lucianojung) to not miss any following posts.
See my latest Projects on [Github](https://github.com/login?return_to=%2Flucianojung) or at [Lucianojung.de](https://lucianojung.de/#work)

-----
#### You may also like:


{% link https://dev.to/bnevilleoneill/running-a-flutter-web-app-and-api-on-node-js-3539 %}

{% link https://dev.to/mercier_remi/what-is-an-api-4ao9 %}

{% link https://dev.to/drminnaar/rest-api-guide-14n2 %}


#### Sources
The Creator of the Icons used in this article is [Flatart](https://www.iconfinder.com/Flatart/families) downloaded from [Iconfinder](https://www.iconfinder.com/).
The Images used in this article are published on [Flexiple](https://2.flexiple.com/scale/all-illustrations).