Questions tagged [api-design]
Application Programming Interface (API) Design discusses best practises for creating libraries intended for general purpose or public use.
1,130
questions
-1
votes
1
answer
52
views
Sending Notification pattern
I am new to backend development and I was building a feature for my project where I can send notifications to various channels (for example slack).
I have a written notification class, which loads the ...
1
vote
2
answers
318
views
Is service discovery an anti-pattern?
We deploy microservices in Kubernetes environment.
For providing a solution to a business use-case using microservices,
Is the idea of service registration and service discovery not an anti pattern? ...
1
vote
2
answers
57
views
Hierachy and API design for a CSS-selector-related Python library
I'm writing a Python CSS-selector library that allows one to write these kinds of expressions in Python as a pet project. The goal of the library is to represent selectors in a flat, intuitive and ...
3
votes
1
answer
124
views
Should I use transactions in this scenario?
I am writing a API endpoint in NodeJs, The code is roughly like this:
function myApi(myUserId, userIdToDelete){
if ( checkIfIAmAdmin(myUserId) ) {
deleteUser(userIdToDelete);
}
}
Now,...
1
vote
3
answers
157
views
What are the benefits of HATEOAS in programs without user interaction?
Let's assume I have a batch job that needs to print orders. It will do so by getting orders from the order service and send them to the print service.
It uses HATEOAS to discover the link from the ...
0
votes
1
answer
128
views
Is it okay to combine bff and rest api?
I'm building an application related to donation on streams.
And I have such models as "alert" and "alert-template".
"alert" is a set of different parameters to understand ...
0
votes
1
answer
128
views
Decoupling thirty dependencies for projects that reference each other in a sequence
I am working on a simple interface to SharePoint via Graph API. I have created a project that references Azure.Core, Azure.Identity, Microsoft.Graph, and other dependencies required to make calls via ...
2
votes
4
answers
179
views
Design of API which is based on third-party implementations
I have 5 interfaces in an API component, which in its turn call an external 3d party solution provider (REST).
The goal is to make this component universal, and under the hood support multiple service ...
1
vote
1
answer
91
views
Exposing DB table to other Microservice via a Library
Consider I have 4 Services .
Account
Order
Items
Customer
Now a External Partner Service calls all these services , by passing an External customer id ( EXT_CUST_ID) in the request.
Our platform has ...
0
votes
0
answers
13
views
Feedback on API design of a HalfEdge Data structure
Background
Sometimes also referred to as doubly connected edge list, the HalfEdge data structure allows programmers to efficiently and easily modify topological and geometric properties of a mesh. ...
-3
votes
1
answer
218
views
I do not like RESTful APIs anymore and dont understand why nobody agrees with me [closed]
Some years ago, every API I developed was a REST API and I did everything to follow the best practices to make them "RESTful".
But after some time, I have my doubts if RESTful APIs that ...
2
votes
1
answer
137
views
web-dev: how to restrict access to costly backend API to authenticated clients only
I've created a small prototype browser plugin and am now thinking about making it accessible to the public. This brings up an important question about gatekeeping API access and the right way to ...
0
votes
1
answer
74
views
REST - Adding a new field
I have an object with fields like ID, CODE, NAME, etc., and it has its own database table with each field. And I am working on implementing the REST API for this object. I want to expose all these ...
0
votes
1
answer
81
views
Why aren't mandatory options requested in the signature of ASP.NET Core "AddXXX" methods?
I've developing a .NET Core library meant to simplify the configuration of the authentication within our SSO system. It will expose two methods to be called in the Program.cs (or Startup.cs) of ASP....
0
votes
0
answers
41
views
Update notification through api end point to SignalR hub or directly in SignalR hub
For updates on a dashboard, I need to decide to make an extra api end point which creates a message in SignalR or let some kind of message broker (filewatcher1) do that. What would be good ...
0
votes
3
answers
209
views
How to build REST uri that fetches children by parent ID
I am building 2 REST microservices: ParentService and ChildService. I need to build endpoint to fetch all Child resources related to specific Parent, so I have these URI's as options:
GET /parent/{...
1
vote
1
answer
99
views
Servlet Development Best Practices
I am developing a web application using Java servlets, and I would like to know what the software development community thinks of the following programming practices:
Use static member variables for ...
-2
votes
2
answers
240
views
API design. Make multiple PUT request or one single PUT request for updating multiple fields of the same database
I have three seperate fields and all three are unrelated to each other but part of the same collection (Tables for SQL folks).
Now, what I'm getting stuck at is, should I allow end-users to make one ...
0
votes
0
answers
52
views
How to Handle Undocumented Fields in OpenAPI Schema?
I'm working with an API that uses OpenAPI for its schema documentation. However, there are certain fields in the request body that shouldn't be visible to all consumers, for example, internalProperty: ...
0
votes
3
answers
122
views
Is it appropriate to use PUT for resources when the id is deterministically derived from immutable properties?
I'm working with a RESTful API where a POST operation is used to create a user. A required field, which could be an email or a unique user nickname, is unique across the system. The response to this ...
-1
votes
1
answer
125
views
What does `/-/` mean in API? [closed]
I often see /-/ in API design, what is it used for?
Is there any related documentation?
I have tried to find it in the following documents, but did not find any relevant information:
https://cloud....
2
votes
3
answers
272
views
Is it bad practice to create a resource in a GET request when the resource will be created later automatically?
At the moment I design a RESTful API for a resource that is normally created by a cron job from existing data.
Since the cron job runs only every 10 minutes it is possible that GET: /user/{id}/...
0
votes
0
answers
38
views
Creating a generic service comprising another service
Currently I have an existing API for my AI Engine, and a python wrapper to interact with the API. So this wrapper acts like a helper class to help format and automate some of the process that is ...
1
vote
1
answer
446
views
Clean architecture - how to manage use cases that depends on external apis
How to apply clean architecture concepts in a software that depends on External APIs.
Example:
A business that offers some kind of subscription to its users.
Its convinient to store some subscription ...
0
votes
0
answers
59
views
JWT Cookie and API Gateway
Background
I have an authentication microservice that handles the user authentication and returns 2 JWT cookies (access_token and refresh_token).
I want to incorporate an API gateway that does the JWS ...
1
vote
2
answers
683
views
Why does IDictionary not implement IReadOnlyDictionary
I've recently just noticed that IDictionary does not implement IReadOnlyDictionary. I'm using two third-party libraries, one of which provides a ToDictionary() method which returns an IDictionary ...
2
votes
1
answer
297
views
Should I put API gateway behind load balancer or vice versa
I am currently learning system design. I wonder if I should put load balancer in front of multiple instances of API gateway or put an API gateway in front of single load balancer. which one is valid ...
1
vote
2
answers
217
views
Is it allowed in DDD application to expose HTTP API endpoints for objects different than aggregate roots?
It's rather common knowledge that aggregate root provides an interface for every state change within that aggregate. For instance, aggregate root checks some business rules before some dependent ...
3
votes
0
answers
179
views
API Gateway Design Pattern - Backends for Frontends
I am contemplating the use of the design pattern API Gateway, specifically the Backends for Frontends derivative.
We have a number of 3rd party software packages that expose an API. Over the course of ...
-1
votes
1
answer
163
views
Help in understanding if my design getting complicated [closed]
I have 3 classes
class Backup
end
class Database
end
Class App
end
The backup database has a reference to Database and App, like
class Backup
def getDatabase
Database.create
end
def ...
0
votes
0
answers
56
views
Translation Server-side vs. Client-side when having the same locales files
I'm currently working on a Turborepo project (monorepo architecture) and I have managed t share my locales files to both back-end and front-end parts.
This means I share the exact same keys across ...
0
votes
0
answers
119
views
Improve return type for CRUD GET list or details objects
When creating the crud GET methods to get a list of items, or the details, what should I return? The whole object properties for both cases? Or just the properties that are necessary? I'm asking this ...
0
votes
1
answer
249
views
Forwarding websocket messages to many clients
I have a wesocket api that constantly send positiondata of many clients as websocket messages. I want to build a web api that connects to the websocket endpoint to receive the positiondata. If a ...
0
votes
1
answer
64
views
Domain Boundary Definition in `proximity service` as a Case Study
While practicing System Design, I decided to create a hypothetical proximity service (like Google Maps) with a microservice architecture. Suppose we have 3 core categories of functionality:
CRUD ...
0
votes
3
answers
767
views
Clean Architecture and Access Control
I'm working on a .Net core API for product configuration and ordering. The ticket for Permissions has come up and I've been tasked with developing a solution, ideas of middleware have been mentioned.
...
0
votes
0
answers
59
views
Decoupling a Configuration API in an Embedded Framework
In my embedded project I am designing a framework that allows the user to create widgets at compile time. All widgets must provide the same base functionality. Further, there are multiple widget ...
-1
votes
1
answer
24
views
How to use versions-maven-plugin with shared contracts?
Context:
We have Java maven Multi Microservices Project.
The structure for each microservice is a contracts package and a service package.
When we update a version of a specific microservice the ...
-1
votes
3
answers
630
views
HTTP REST API: Is it wrong to put search parameters in a custom header?
The contents of search string are typically sent as part of the URI query:
https://domain.name/resource?search=something+i+am+searching+for
Those same contents can be sent as the value of a custom ...
0
votes
1
answer
63
views
API design with conditional compilation: stubs and exceptions vs public API change?
I am developing a package for the Unity game engine. I want to add additional functionality to my package if another specific package is present. I am faced with a dilemma I am not sure which of these ...
0
votes
2
answers
221
views
How to keep OpenAPI specification up-to-date and compliant without using code generators?
In our company, there is no standard for how to document APIs. Missing API documentation slows down the development process.
Therefore, we want to introduce OpenAPI.
We want to use code generators to ...
3
votes
2
answers
246
views
Best approach to microservice shared databse architecture
I have two microservices, one Flask (python) and one Spring (java), they currently share a database. The Flask microservice handles processing json files (~40mb) for each user (could be 100's or 1000'...
1
vote
3
answers
827
views
Correct way to return JSON schemas in a REST API
in our company we have some APIs that return some JSON data. Before sending, for instance, data to the backend using PUT, PATCH, or POST, we need to do some kind of validation in the different clients ...
0
votes
1
answer
88
views
How to improve a monthly usage quota system for an API with growing number of users?
Couple of years ago, I designed an API service which has a limit on the number of requests per month per user. To track the monthly usage of each user, I used a table called monthly_usage. The table ...
0
votes
3
answers
411
views
Should a REST endpoint return always the same JSON fields?
For example, let's say that I have an endpoint to get a list of buildings, that can be either apartment or house. The client can filter by apartment or house. Apartment has a property floor that house ...
1
vote
0
answers
88
views
Limiting exposed interface for state transitions
Scenario: Given a class with some internal state and methods to manipulate this state, I want to limit the exposed methods that are available to potential clients/users of my API.
TLDR: In the ...
0
votes
1
answer
147
views
Sink or non-sink API's?
This might be an opinionated question but I'm eager to hear your anecdotes as I'm at the beginning of designing a new API. Now I'm questioning whether I want this API to be a sink API or non-sink API. ...
-2
votes
1
answer
190
views
Adding new column(s) to DB Table breaks existing queries [closed]
Dilemma: I am working in microservices (MS) architecture for a product with shared (PostgreSQL) DB between MSes and DB Views exposed as Data Access API between SW Components, written and maintained by ...
-1
votes
1
answer
121
views
What is point of having certain microservices making another API call in the same service
I was going through an old, largely untouched part in my company’s codebase and found one API. It does the following things.
A POST API with path host/entities/trigger which fetches a list of entity ...
5
votes
2
answers
733
views
Why does C# List<T>.AsReadOnly() allocate?
I am looking at the List<T>.AsReadOnly() method.
Since List<T> itself is a IReadOnlyCollection<T>. (It implements IReadOnlyList<T> and IReadOnlyList<T> implements ...
0
votes
1
answer
214
views
Exchanging data between two Microservices
I am facing this problem and would like to review my approach to it here.
A Client sends an HTTP request to Service A and is expecting an answer.
Service A is connected to DB A. When it receives a ...