Skip to main content

Questions tagged [api-design]

Application Programming Interface (API) Design discusses best practises for creating libraries intended for general purpose or public use.

Filter by
Sorted by
Tagged with
2 votes
3 answers
216 views

Say I have the following header #ifndef WINDOW_HPP #define WINDOW_HPP // includes... namespace window { struct Window { GLFWwindow *handle = nullptr; }; struct ...
user avatar
0 votes
2 answers
216 views

I am doing the frontend for a Java Spring backend. The project uses JavaFX for the front but I a migrating it for web usage (with VueJS). When I make an API call to retrieve an object, I am receiving ...
Bernardo Benini Fantin's user avatar
1 vote
1 answer
147 views

I am currently rethinking my API response schema and caching strategy while implementing ETag-based caching for a paginated REST API (for example, listing places). Each paginated response looks like ...
Meds's user avatar
  • 19
1 vote
3 answers
313 views

I’m building an app that lets users manage data across multiple tables. I also expose an API so they can fetch their data and process it in external services. I’d like to enhance the API to support ...
Axel Chalayer's user avatar
1 vote
2 answers
606 views

I just started learning about the specification, but I still have some doubts about why GraphQL simply hasn't replaced REST since it was created. REST APIs are very inflexible and straightforward. ...
Sami Daniel's user avatar
2 votes
1 answer
190 views

I'm working on a web-based app that uses Django and Angular. This app uses several external APIs to fetch environmental data from different monitoring networks. We then use these data to perform ...
stray_dog's user avatar
0 votes
1 answer
169 views

I want to create one service that reads data from two databases and passes it to the customer devices. Is this an overall bad design decision? I think that since it is only read-only, it should be ...
Travis's user avatar
  • 121
2 votes
8 answers
553 views

Say I have a contract returning a type: type CreditCard = { scheme: "Visa" | "Mastercard" } and later we decided to include Amex as card type, then making this change: type ...
dwjohnston's user avatar
  • 2,769
2 votes
1 answer
188 views

Preface: This will not be available publicly or to third parties, so I am not concerned about users having the background knowledge to properly form GET requests. These are also not only analytical ...
user avatar
2 votes
2 answers
175 views

I'm facing a tricky situation that might result from a not thoroughly thought-out design, and I'm hoping to understand whether a deadlock might be a realistic cause – and if so, how to prevent similar ...
ComfortableOnion's user avatar
2 votes
3 answers
322 views

A typical search query looks something like GET example.com/entity/search?q=John If we want to add some filtering to this endpoint, we could for example add ...&filter= followed by a URL encoding ...
aioobe's user avatar
  • 957
0 votes
3 answers
345 views

I recently read through Hypermedia Systems, and found its arguments incredibly compelling. The book brought a lot of clarity and structure to ideas and frustrations that have been bouncing around in ...
DMJ's user avatar
  • 111
1 vote
1 answer
259 views

I came across this system design question and have been wondering what is a good approach. Requirement : We have a typical blog or a mini social media kind of website where users create "Posts&...
brahmana's user avatar
  • 154
3 votes
5 answers
1k views

I work with a lot of Groovy code. One feature of the language is the "safe navigation operator" (?), which I think of as an inline null check. There are many things about Groovy that I like, ...
Gus Murphy's user avatar
0 votes
1 answer
279 views

I'm devising an API - or actually, a wrapper API for another, lower-level API - in a programming language with objects. This API represents some entity E which is reference-counted (for example - a ...
einpoklum's user avatar
  • 2,808
3 votes
3 answers
1k views

I am designing a fluent builder pattern API that branches and allows different options based on what has already been called. For example: Build().Foo().Bar() is valid code, but Build().Baz().Bar() ...
starikcetin's user avatar
2 votes
3 answers
3k views

I am building a web application. This application is meant to be a home for player rankings and tournament results for a competitive community. I have planned to do this in three layers: a database to ...
John Johnson's user avatar
2 votes
1 answer
302 views

Problem: I am building a FastAPI based API and need to design a role-based permission system for authorization. Users can have one of three roles: Admin, Developer, and Operator. These roles are ...
Mehdi Ben Hamida's user avatar
1 vote
3 answers
170 views

This may be one example of a very general design question. Suppose I am building a service and I want the client to provide the location of some data on S3 which I will then read and process. How do I ...
allstar's user avatar
  • 123
0 votes
1 answer
194 views

I am writing an API for a payment system. Third parties can register callback URLs that are linked to an account ID so that whenever a transaction involving that account ID is updated, my API calls ...
Adrian Albert Koch's user avatar
-1 votes
1 answer
86 views

SMHI´s API have the below documentation for its properties. What intrigued me is the value range (0-8) for 'tcc_mean'. Not only does it differ from other properties on the API, for example humidity ...
David's user avatar
  • 313
0 votes
1 answer
138 views

In OpenAPI, is there a convention for denoting that your API is not stable yet? In semantic versioning, the v0.x.x version number is usually used to indicate that the project is not stable yet. ...
Kyle Richards's user avatar
0 votes
1 answer
549 views

Here is an Example API for managing companies, employees, and their children. My entity relationships are as follows: company -1:n-> employees -1:n-> children I’ve structured the API routes ...
Doku's user avatar
  • 111
4 votes
4 answers
958 views

I've been wondering for a while why an ArrayList does not have a stack-like interface (think push() and pop()) I frequently find myself using these constructs in Java: list.get(list.size() - 1); list....
Mark Jeronimus's user avatar
0 votes
2 answers
301 views

Starting Point: According to https://www.rfc-editor.org/rfc/rfc9110.html#name-safe-methods, when making a GET call, the client is not requesting and not expecting the call to lead to any state changes....
user1995099's user avatar
-1 votes
2 answers
210 views

I have 6 endpoints that return 6 json response: /cities/{id} return a json object: { "city": "Orlando", "altitude": 10 } /cities return an array: [{ "city": &...
Accollativo's user avatar
1 vote
1 answer
210 views

I need suggestion / recommendation on the design approaches mentioned below. UseCase: I have a usecase where a client uses my system to generate some recommendations. Now, these recommendations are ...
Passion's user avatar
  • 19
0 votes
2 answers
168 views

It is well known that Direct3D, unlike OpenGL, was never extensible in itself - a deliberate choice of Microsoft to favor the average user's expectations of predictable behavior and inherent ...
cher-nov's user avatar
  • 101
7 votes
4 answers
2k views

I'm working on a API for the logistics department, and I have a resource called logisticTransport, which is an entity in our database. I'm facing a challenge with maintaining consistency when ...
danidcode's user avatar
0 votes
1 answer
261 views

As my next spare-time project, I'm considering writing a suite of compatibility header and associated library, that eases the transition from Single Unix Specification v4 to v5 and C11/C17 to C2X. C++ ...
DannyNiu's user avatar
  • 374
1 vote
1 answer
244 views

What would be the best way to have a single REST API but with multiple "backends" (Not sure if this is the correct terminology)? Currently we have a basket/cart API that handles product ...
gsck's user avatar
  • 137
6 votes
4 answers
2k views

Over the years I've run into (and created) APIs around device communication (Serial, USB, TCP, Bluetooth, etc). At the bottom of these APIs are usually byte streams that can send data to the device ...
Rick de Water's user avatar
0 votes
1 answer
231 views

I am making a webapp that deals with money movement. All the financial actions are done through an API. For example, right now I can create an account for a user, add funds to their account, transfer ...
Mitchell Jeppson's user avatar
1 vote
0 answers
120 views

I work on a spring kotlin backend which has an angular and a mobile frontend. We are currently working on error handling and we decided that the backend should return an error code, a general message (...
Christian's user avatar
  • 119
-1 votes
2 answers
627 views

Say you have a REST API endpoint like POST /move-money which transfers money from your main account to a savings pot. There are three path parameters accountId for the user's account potId for the ...
MZokov's user avatar
  • 101
1 vote
1 answer
359 views

When designing types and their APIs, I try to adhere to these simple principles (which vaguely feel like one general principle to me) as much as feasible: There is a one-to-one correspondence between ...
suushikijitsu's user avatar
0 votes
1 answer
147 views

Just for some context, I am a CS student in my second-year who is working on a C++ desktop application (using the Qt framework) made by an engineering professor. The application is an educational tool ...
Johnny's user avatar
  • 1
-3 votes
1 answer
173 views

I have a HATEOAS API (in ASP.NET) with an endpoint: POST /api/messages - to create a new message and it returns the location of a new message Now I have a requirement that in some cases based on ...
MarisKs's user avatar
  • 97
11 votes
5 answers
3k views

I have a "Games" API which retrieves video game data from a large database. The /games endpoint returns some very basic information about the game, such as the title, description, etc. More ...
Yeager's user avatar
  • 121
0 votes
0 answers
292 views

I would like to be able to build up a log of user activities, capturing data such as who they were, where they logged in from, what activity did they take, and what data did they change (both before ...
David Keaveny's user avatar
0 votes
1 answer
723 views

One post can have many comments. How can I design REST API urls for HTTP POST and HTTP PATCH for comments. My idea is to have the following endpoints: HTTP GET: /posts/{postId}/comments HTTP GET (all ...
Aleksander Chelpski's user avatar
0 votes
3 answers
2k views

I have an api which returns records given some constraint. Let's say 50000 records meet the constraint. Because we can not return all the records at once, so I have to implement pagination. I am also ...
best wishes's user avatar
1 vote
3 answers
684 views

I'm building an application that allows the creation of users. These users can have profiles which define their permissions, as well as be given specific permissions. Now I'm struggling on deciding ...
Gary Holiday's user avatar
  • 1,201
1 vote
5 answers
1k views

If I have for example a User POJO like the following @AllArgsConstructor public class User { @Id private final String id; private String username; private String password; private Date createdDate;...
iqueqiorio's user avatar
1 vote
3 answers
361 views

We have an API that allows clients to POST some request which takes some time to complete, so the API simply places it on a message queue and returns a 202 (Accepted) and a new GUID in the body. The ...
JoelFan's user avatar
  • 7,161
0 votes
1 answer
173 views

This is a design problem that has plagued me from web apps to embedded systems. It seems that my fellow developers don't really care at all, so I've never seen an established pattern. In short: how ...
allthewayaround's user avatar
-1 votes
1 answer
77 views

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 ...
AlwaysBlue's user avatar
2 votes
2 answers
625 views

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? ...
user1787812's user avatar
1 vote
2 answers
90 views

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 ...
InSync's user avatar
  • 137
3 votes
1 answer
186 views

I am writing a API endpoint in NodeJs, The code is roughly like this: function myApi(myUserId, userIdToDelete){ if ( checkIfIAmAdmin(myUserId) ) { deleteUser(userIdToDelete); } } Now,...
Alessandro's user avatar

1
2 3 4 5
24