A | pplication |
P | rogramming |
I | nterface |
To interact between two applications. Allows other programs or application to use functionality that you expose:
- Functions
- Protocols
- Objects
# Weather Data Example
Request:
GET https://www.7timer.info/bin/astro.php
?lon=15.593063
&lat=48.411018
&ac=0
&unit=metric
&output=json
Response:
HTTP/1.1 200 OK
Content-Type: application/json
{
"product": "civil",
"init": "2023070206",
"dataseries": [
{
"cloudcover": 7,
"temp2m": 21,
"rh2m": "63%",
"wind10m": {
"direction": "W",
"speed": 3
},
...
]
}
# API Keys
- like username + password
- prevent from DDOS-attacks (spam, overloading)
# API Use-Cases
- Frontend - Backend Communication
- Component Communication
- e.g. One Service calls another service
- DaaS
Desktop As A Service
- Cloud computing - access desktop (virtual desktop) over internet
# Frontend-Backend
Using APIs, you can link any software parts, potentially using different technologies, as long as they support the same protocol.
# Component Communication
Communication between elements = APIs (arrows)
# Protocols
Through OSI-Model. There are several common protocols used in APIs.
# Attributes of protocols
Protocols …
- allow exchange of messages and information between 2 processes.
- Processes don’t need to be on the same physical machine. Can be distributed and communicate over network.
- are open to any technology or programming language.
- have a clear specification.
# API-Programs
# Postman
open-source API platform for building & using APIs