File API Design Decisions
Learn what design decisions will best suit the file API.
We'll cover the following...
In this lesson, we examine the overall operation of the file API and the interaction of the individual components. This will help us make certain design decisions while diving deeper into the design challenges.
Design overview
There are many architectures that lead to good API design, but we can’t simply pick one and start developing. API design is often influenced by business requirements, technologies used, etc. Therefore, defining a simple step-by-step guide for choosing an architecture may not be possible. Often, a combination of multiple architectures work in tandem to achieve organizational goals. Let’s go over the design considerations of a file API and determine the suitable ingredients (architecture style, data format, etc.) to satisfy our needs.
The following diagram contains the detailed workflow of the components and services involved in the file API design.
Let’s look at the functionality of these components and services in the table below.
Components and Services Details
Component or Service | Details |
File servers |
|
Processing server |
|
User to file mapping system (UFMS) |
|
Blob storage |
|
Temporary storage |
|
User server |
|
SQL database |
|
CDN servers |
|
API gateway |
|
Client |
|
Workflow
For a better understanding, we can divide the workflow shown in the illustration above into the following two parts.
Client to API gateway: Before performing any operation (upload, download, and so on), the API needs to authenticate the client and ensure that it has read/write access to the data. After successful verification, a user can upload, download, list, or delete a file from the server through HTTP requests.
API gateway to downstream services: As the request reaches the API gateway, the gateway forwards the request to the appropriate API services. If the request is to upload a file, the application server extracts the metadata (such as user ID, file name, file size, file location, ...