Designing APIs

APIs?⌗
What are they and what are they used for?⌗
Generally speaking: API are application programming interfaces that allow developers to make use of another piece of software through defined interfaces. This means that you could use the API of Twitter for example and try to use their software for something (eg. grab a post). There are several types of APIs which may be consumed by a human or just by another (non public) piece of software that’s internal to the APIs maintainer.
This is all depending on the usecase.
There are three main types of APIs.
Types⌗
RESTful API⌗
This is generally speaking the best option for most things.
I personally choose this type because of it’s simplicity and wide adoption.
Go API first with Open-API or use Swagger
Remote procedure call (RPC)⌗
This is chosen if performance is necessary and the company guidelines allow it.
The main benefit is, that you are forced to write a protobuf file first (API contract) which both services can then generate their classes/models from.
Event-driven systems (Kafka)⌗
Some systems are even event driven which means there is a a different point for ingestion.
Kafka would be such a source of ingestion and can also be used as a data sink again.
Go API first with Async-API
Take a look at THIS article to learn a little more about event-driven architecture.