1. REST API

To better understand APIs in the context of Ngenea Hub, let’s start with a quick overview of what an API is and its essential concepts.

An API (Application Programming Interface) is a set of rules and protocols that allows software applications to communicate with each other. APIs define how to request and send data, which functions are available, and what responses can be expected.

What are Remote APIs?

Remote APIs are APIs where the software making the request and the software providing the data are on different machines or different networks. These APIs work over the internet or a network, using tools like HTTP.

What are Web-Based APIs?

Web-based APIs are remote APIs that use web protocols like HTTP or HTTPS to communicate. They often send and receive data in formats like JSON. These APIs are widely used in websites and mobile apps to get or send data.

What are REST APIs?

REST (Representational State Transfer) APIs are a special kind of web-based API that follow a specific set of design rules. They use URLs to identify resources (like a user or a file) and HTTP methods like GET or POST to perform actions on those resources.

When is an API called RESTful?

An API is called RESTful when it follows the rules (constraints) of REST. It must behave in a certain predictable way, such as using HTTP properly and not storing client information on the server between requests.

What Are the Constraints that make an API REST?

  • Stateless: Each request from a client to the server must contain all the information needed. The server doesn’t remember past requests.

  • Client-Server Architecture: The system is split into clients (apps, browsers) and servers (data providers), and each focuses only on its role.

  • Cacheable: Responses can be stored by the client to avoid repeating the same request.

  • Uniform Interface: There is a standard way to access resources (like using GET to read data, POST to create).

  • Layered System: The system can have layers (like security, load balancers) that the client doesn’t need to know about.

  • Code on Demand (optional): Servers can send code (like JavaScript) to the client to run if needed.

How is JSON Related to API?

JSON (JavaScript Object Notation) is a simple format for organizing and exchanging data. When an app talks to an API, the API often replies with data in JSON format.

What is an OAuth Token?

An OAuth token is like a digital key that lets someone use a service without logging in every time.

HTTP Verbs vs CRUD Operations

HTTP Verb

CRUD Operation

Example Action

GET

Read

Get user details

POST

Create

Add a new blog post

PATCH

Update (partial)

Change only the email address

DELETE

Delete

Remove a user

Now, we’ll focus on understanding the APIs specifically for Ngenea Hub.