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
1 answer
159 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
100 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
827 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 ...
71 votes
4 answers
28k 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
64 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
201 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
77 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
23 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
87 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 ...
0 votes
3 answers
89 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/{...
-2 votes
2 answers
66 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
36 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
1 answer
530 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> &...
0 votes
3 answers
81 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
58 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 ...
2 votes
1 answer
540 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 ...
0 votes
1 answer
420 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 ...
-1 votes
1 answer
122 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
211 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}/...
1 vote
3 answers
310 views

How to handle API's validation based on a flag

I have the following case: If the user is in the UK, the server needs to validate the bank details as Account number and Sort code number If the user is in France, the server needs to validate the ...
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
2 answers
337 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 ...
2 votes
1 answer
178 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
1 answer
355 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
1 answer
136 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 ...
5 votes
1 answer
188 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 ...
0 votes
0 answers
46 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 ...
2 votes
3 answers
185 views

Rest API: paths versus queryparams for user accounts

I'm looking for some guidance around REST design for user account endpoints. I generally understand REST and some of the principles involved, with paths being used to fetch items from a resource: /...
1 vote
2 answers
453 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 ...
5 votes
6 answers
47k views

Is it okay to use POST for REST API updates?

For some time I used PUT or PATCH in order to update a REST API resource. After using a lot of PUT/PATCH calls I noticed that "update" could be also done with POST. Here is an example which is ...
0 votes
3 answers
780 views

Web API Bad Request design

My organization is developing a Web API server. We will also develop the only clients authorized to access the API. We will follow the usual technique of returning Bad Request (400) errors for data ...
1 vote
2 answers
169 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
157 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 ...
0 votes
1 answer
139 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 ...
6 votes
3 answers
2k views

Difference between API and protocol?

What's the difference between an API and a protocol? To use a specific example: Is Coinbase's choice to refer to its WebSocket client specification as an "API" appropriate? It seems that ...
0 votes
0 answers
56 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
160 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
49 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
69 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 ...
5 votes
3 answers
726 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 ...
3 votes
1 answer
310 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
1 answer
722 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
508 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
2 answers
1k views

Rest API design - endpoints for multiple types

REST APIS are a Uniform interface. Is it better to add functionality to the search parameters of a GET request with a query parameter, than to add nested resource identifiers to a collection /exists ...
-1 votes
3 answers
351 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 ...
-1 votes
1 answer
15 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 ...
0 votes
2 answers
185 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 ...
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 ...
5 votes
1 answer
418 views

Can an api gateway handle websockets requests besides regular http requests at the same time?

I am working on social platform with a distributed architecture. The platform should offer a chat module, but since the most efficient way to implement a chat is using websockets. I am not sure what ...
1 vote
3 answers
505 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 ...

1
2 3 4 5
23