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
-4 votes
0 answers
14 views

Website where I can seek architectural advice/designs available for a credit-based course registration system? [closed]

I need to design the architecture for a website for registering for credit-based courses for students. Each semester, students can register for a maximum of 30 credits. Courses can be mandatory or ...
0 votes
0 answers
21 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 ...
2 votes
1 answer
588 views

Neo4j graph performance: should I cache slow queries in a separate database?

Setup/Intro I have 10k+ nodes in my Neo4j graph in which I need to display a sub-graph (100-500 nodes) between 2 start/end nodes on the frontend app along with info about the critical path and all ...
-3 votes
1 answer
83 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 ...
-1 votes
2 answers
173 views

Firmware development philosophy in function wrapping

I wrote some code in the past for 8bit MCUs, realizing that every time I gained experience, the next iteration will be with a wrapper API or something more distant from the "bare metal" register ...
2 votes
2 answers
439 views

Error Codes with Properties Files or Database

I'm about to implement Error codes for my company API, so, based on rfc7807 I will include a type which is an error type which is basically an error category, and inside those categories we have a ...
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 ...
1 vote
4 answers
744 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
2 answers
410 views

MVC-like architecture: Model-Controller communication of results/status

I'm struggling on designing a solid architecture for my project. In particular, I don't know how to handle the communication between the models and the controllers. My goals are: Following the ...
0 votes
0 answers
49 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 ...
10 votes
6 answers
3k views

Designing function based RESTful API

Please settle an argument between me and a friend. We'r currently designing a product API. Our Product entity looks like this { "Id": "", "ProductName": "", "StockQuantity": 0 } Product ...
0 votes
1 answer
218 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 ...
0 votes
1 answer
112 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 ...
0 votes
3 answers
155 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 ...
0 votes
2 answers
188 views

Who to manage AAA , gateway or business service

In a debate with our solution architect, there were 2 proposed solutions to handle (illustrated below on the figure) In the first, the API Gateway manages Authentication, Authorization and Accounting ...
5 votes
4 answers
794 views

Designing a flexible search API response

Quick Summary I'm building a search micro-service that will allow searching across different types of resources in a particular system (e.g. blog posts, users etc.). The API that will be exposed will ...
1 vote
1 answer
973 views

Securing API with JWT and elevated access using MFA

At my company we have a central auth server running IdentityServer. There are a number of applications providing some API to client applications. API requests are authenticated with JWT tokens issued ...
0 votes
3 answers
179 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 ...
1 vote
1 answer
569 views

Is it an anti-pattern on React to search for children with a specific element type?

Context When designing the API of a React component, you may decide to receive props in a more semantical way. Here's a simple example <Modal headerTitle="foo" /> vs <Modal> &...
1 vote
5 answers
265 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;...
-1 votes
1 answer
592 views

REST API designing resources for complex entities

I have an ASP.Net Core Web API where I am having difficulties designing the REST resources based on the EF Entities I have. There are three entities that describe a Reservation. First, there is the ...
6 votes
3 answers
2k 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
3 answers
222 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 ...
0 votes
1 answer
73 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 ...
-1 votes
1 answer
58 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 ...
5 votes
1 answer
198 views

Dependency management for facades/adapters to cloud services (SemVer?)

Suppose I have a library, that basically works as a facade to some cloud service (e.g. JavaScript API that wraps around network calls to some RESTfull service). And once that service introduces a ...
4 votes
2 answers
2k views

How to manage database changes and sync data with multiple api versions

We're working with ASP.NET Core web API and looking for a couple of doubts that we have. The versioning documentation recommended creating multiple controllers: Contoso └ Api ├─ v1 │ └ ...
0 votes
1 answer
267 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 ...
1 vote
2 answers
374 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
58 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 ...
114 votes
5 answers
86k views

Should I return an HTTP 400 (Bad Request) status if a parameter is syntactically correct, but violates a business rule?

Say that I have a REST endpoint that takes an integer as a parameter: /makeWaffles?numberOfWaffles=3 In this case, I want the number to be positive because I can't make a negative number of waffles (...
2 votes
1 answer
143 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 ...
3 votes
1 answer
133 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,...
3 votes
1 answer
388 views

What are some design ideas for a data mapping and transformation application?

Here is a high level outline of the project: We frequently need to convert data from a new incoming system to our in house system (sort of a basic ETL process) We would prefer to do this dynamically, ...
1 vote
3 answers
183 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 ...
2 votes
4 answers
199 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
96 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
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. ...
-3 votes
1 answer
278 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 ...
0 votes
1 answer
856 views

Adding resources to subresource REST API

I'm trying to build an web API that closely represents a library of books. I currently have the following routes. GET /api/books GET /api/books/:bookID GET /api/libraries POST /api/libraries This ...
72 votes
4 answers
29k views

Why PATCH method is not idempotent?

I was wondering about this. Suppose I have a user resource with id and name fields. If I want to update a field I could just do a PATCH request to the resource like this PATCH /users/42 {"name&...
0 votes
1 answer
95 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 ...
3 votes
2 answers
298 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'...
0 votes
1 answer
87 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
78 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 ...
1 vote
1 answer
115 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
879 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
88 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
295 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 ...
0 votes
1 answer
81 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 ...

1
2 3 4 5
23