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
1 vote
1 answer
143 views

REST API with swappable backends

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
1k views

Separate unidirectional streams vs single bidirectional stream

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
97 views

How to handle data when source of truth is through API

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
59 views

How to model api error type with errorCode and parameters

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
193 views

Idempotency for a financial transaction API

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
297 views

Is there a name for this API/type design principle? (I think of it as "state hygiene")

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
66 views

Designing a restful API for a desktop application to facilitate communication with other APIs

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
102 views

HATEOAS API - best practice to create multiple entities in one request

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

Why split up data retrieved from a database into multiple endpoints, if we need ALL the data anyway?

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
123 views

Approach for comprehensive data/activity logging

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
227 views

POST and PATCH for a nested resource in REST API

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
471 views

Pagination api for huge number of records

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
0 votes
3 answers
233 views

Where should my users permissions live?

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,181
1 vote
5 answers
496 views

DTO vs POJO (Entity) on POST request

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
245 views

Should this request return a status of 404 or a different status

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,091
0 votes
1 answer
79 views

Function parameters using IDs vs full data objects

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
63 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 ...
AlwaysBlue's user avatar
1 vote
2 answers
409 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? ...
user1787812's user avatar
1 vote
2 answers
63 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 ...
InSync's user avatar
  • 111
3 votes
1 answer
142 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,...
Alessandro's user avatar
1 vote
3 answers
189 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 ...
wertzui's user avatar
  • 119
0 votes
1 answer
461 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 ...
eugenedrvnk's user avatar
-2 votes
1 answer
325 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 ...
Sigmundur's user avatar
  • 105
2 votes
4 answers
209 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 ...
PavelPraulov's user avatar
1 vote
1 answer
105 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 ...
Dev-vruper's user avatar
0 votes
0 answers
17 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. ...
Makogan's user avatar
  • 261
-3 votes
1 answer
334 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 ...
David Mason's user avatar
2 votes
1 answer
151 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 ...
lhk's user avatar
  • 446
0 votes
1 answer
136 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 ...
Arpit Jain's user avatar
0 votes
1 answer
94 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....
Gua-naiko-che's user avatar
0 votes
0 answers
96 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 ...
Jannick Breunis's user avatar
1 vote
4 answers
1k 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/{...
milosdju's user avatar
  • 111
1 vote
1 answer
134 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 ...
TTCUSM's user avatar
  • 21
-2 votes
2 answers
1k 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 ...
CrumpledMemories's user avatar
0 votes
0 answers
100 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: ...
Sergey Kolesnik's user avatar
0 votes
3 answers
509 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 ...
Sergey Kolesnik's user avatar
-1 votes
1 answer
134 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....
Sangria's user avatar
  • 11
2 votes
3 answers
1k 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}/...
Timo's user avatar
  • 29
0 votes
0 answers
46 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 ...
rcs's user avatar
  • 99
2 votes
1 answer
1k 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 ...
Rafael Alencar's user avatar
0 votes
0 answers
118 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 ...
Neil's user avatar
  • 9
1 vote
2 answers
2k 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 ...
Andrew Williamson's user avatar
8 votes
3 answers
3k 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 ...
Patrick's user avatar
  • 203
1 vote
2 answers
403 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 ...
Jacek's user avatar
  • 119
3 votes
0 answers
252 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 ...
Ryan Wilson's user avatar
-1 votes
1 answer
167 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 ...
Raja G's user avatar
  • 109
0 votes
0 answers
91 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 ...
Jolan B.'s user avatar
0 votes
0 answers
225 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 ...
celsomtrindade's user avatar
0 votes
1 answer
99 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 ...
Andrew Sharifikia's user avatar
2 votes
3 answers
2k 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. ...
Tod's user avatar
  • 123

1
2 3 4 5
23