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
3
votes
2answers
110 views

How can we use DDD when data comes from API?

I am trying to create a social network app. When I started I had proper domain models for Feeds, Activities, Author etc. with all the behaviour encapsulated within the Objects. I had the luxury of ef-...
0
votes
4answers
43 views

When to throw error in response vs save error in database for POST API

I am creating a API to create Personnels of X city. Assume that there is a generalised service for creating personnel of any city and I want to call this service for X city personnels from my API. ...
2
votes
1answer
126 views

Multiple HttpClients in .NET Core Console Application

I'm building a .NET Core class library wrapper for a REST API that, ideally, could be used in both console applications and ASP.NET Core web applications. So far, I've based development on supporting ...
0
votes
0answers
41 views

Best way for resource (entity) relations loading in a REST API

We have a problem of load time in our REST API, which is the result of having Fat DTO (nested DTO s) & the N+1 problem (which is off my question), means that we are loading too much data in one ...
-3
votes
1answer
44 views

Long variable naming with chained filters on API best practices?

I am writing an application where a single variable may be affected by different filters applied to the data that's read from the DB. Each different variation has to be stored (as each one serves ...
0
votes
0answers
21 views

Designing a public facing Java interface for future extensibility (API evolution)

I develop an in-house Java framework. I provide an interface so that my end users can provide their own custom implementation (i.e. plugin/SPI). public interface SomePlugin { SomeResponse ...
0
votes
1answer
100 views

Is this an anti-pattern to have a service have both APIs and listening to events?

I am planning to make a service which will have simple REST APIs and will have a database in backend. I also wanted to add a logic to listen to notifications emitted by other service and there is some ...
1
vote
2answers
65 views

How can I ensure the client and server both have access to all API calls in use?

On multiple occasions, we've deployed frontend code to production only to find out the backend (REST or GraphQL) hasn't shipped their side yet. Worse yet, we unexpectedly find out a param name changed ...
-2
votes
2answers
68 views

Signing up users who have not registered

I am building an app where you can invite your friends to join the platform and discuss various topics. (almost Reddit). Functionality: When you create a topic you can enter the email of users you ...
5
votes
2answers
213 views

Merits of passing function arguments through a single struct

A coworker has started advocating for a style for our user-facing APIs where every function takes a single struct parameter containing all the real parameters. That is, instead of: void fn(int foo, ...
0
votes
1answer
32 views

API Split for creating object with inheritance and behaviors

I have a web service which is exposed to UI owned by our team. This web service is responsible for creation of objects and saving it in the DB (NoSQL Database). The object being created has multiple ...
0
votes
1answer
40 views

REST action as part of request body - action not stored alongside entity

I am working on an API that allows a client document to updated under the endpoint of PUT /client/{documentId}. As part of this document, I need to include an extra field 'ReplicateInManager' that ...
1
vote
1answer
90 views

SDK design: Should I parse enum as string or as enum?

I am building a SDK that will simplify the use of my API. The problem is if when I have to return property of type enum. For example, I use strings instead of int for displaying enum such as { "...
0
votes
0answers
67 views

API Design (RPC - RESTful)

I'm new to API design. I've been reading numerous threads RESTful vs RPC patterns for API design, but I feel like none directly addressed my exact use case, so I just wanted to get a second opinion. ...
0
votes
1answer
60 views

Problems with software layers in complex query methods

I desingned a rest api software with 2 simple layers: Controller and Service. The controller handles the coming http request and redirect to a service method. In the beginning of development every was ...
-2
votes
2answers
68 views

How to call the API once per event-message?

I have X number of servers in NLB listening to an event that gets published by a backend system. I am planning to develop a windows service that listens to the event and then calls an internal API. ...
0
votes
0answers
70 views

Best design pattern to map functions/wrap functions that will be used by client apps

Abstract: I'm attempting to create a "data interoperability API" or in other terms "high-level query interface API" that will be consumed by (data scientists, web apps, any who wants to query ...
-4
votes
1answer
46 views

How can I connect to a kitchen printer (or any receipt printer) and make it print custom online orders?

If I were building an online food ordering app but I wanted to print a receipt to the kitchen, how would I do that? There are many SaaS solutions available like Uber Eats and other apps that allow ...
0
votes
1answer
36 views

How to manage HTTP, POST with JSON data payload and Binary Image file?

Example scenario, API endpoint for a Product with Product information as JSON data and there can be 0 to n number of binary Images. Currently we upload as Binary file, with both Image and JSON data ...
-2
votes
1answer
43 views

Reducing duplicate API call between micro services in a latency sensitive flow

Let's suppose that I have 5 microservices, let's also name them ServiceA, ServiceB, ServiceC, ServiceD, ServiceE. To perform an operation X communication needs to happen between these services. And ...
0
votes
0answers
34 views

How to design a nodejs API as typical OOP way using typescript?

I need to design a nodejs typescript API using typical OOP way with controllers and modals, here I am adding a code base for invoice API of the system. can anyone suggest best approach to design in ...
0
votes
2answers
112 views

Is it an anti-pattern for a REST-ful API object to contain different fields depending on context?

I'm working on an API that allows users to invite each other for events. When someone is searching for users to invite, I want to include in the response information about whether a user has already ...
-4
votes
1answer
61 views

Best practices when interfacing Python and C code

I have a piece of code that I developed in an academic context for which I would like to build a nice frontend. My approach to coding has been very academic to this point (read: I made stuff up as I ...
-1
votes
1answer
44 views

Exposing java service as static method or seam dependency

Our legacy application provide a static method public static boolean persist(Data data) for service/class callers for data persistence. I do see unit testing issue for callers. Is this also an ...
1
vote
2answers
41 views

Identify segment in grid

Imagine a grid like the one in the image. I have to model an API which identifies a single segment inside a grid (like the one painted in red). I thought the segment should be represented with ...
0
votes
2answers
65 views

Rest API relationship design

I have a question in regards to designing relationships in REST API's. Imagine I have a relationship like in this diagram Now, should I show the relationship in the team endpoint like this? /v1/...
2
votes
1answer
62 views

Proper way to put a fixed hash as Authorization

I am implementing a system for a customer where they are asking me to use a fixed hash to protect the API as authorization. So this fixed value will be sent in the HEADER of the HTTP call as "...
2
votes
0answers
57 views

How to design job-handling for API

I am not sure if this is the correct place to ask, please direct me to the correct place if this is not it. Context I have written a do-all, keep-all, serve-all API (it started small, then grew out ...
0
votes
2answers
53 views

Calling Microserice using REST or dedicated client jar

When microservices need to talk with each other, the common practice will be to have some REST (or gRPC) communication. I'm wondering what should be a better approach? (let's assume all services are ...
0
votes
2answers
53 views

API GET Request: Annotating data that the user hasn't seen before without breaking GET rules

I am implementing a feature in an app where a user can unlock achievements, and when the client requests what achievements the user has unlocked, the client needs to know the user hasn't seen it ...
-1
votes
1answer
49 views

Configuring Controllers and Endpoints in a HTTP API

Let's say you need to create an API around machines, and you want to be able to query machines many different ways: Get List of all Machines Get Machine By ID Get Machines By Client Get Machines By ...
5
votes
4answers
327 views

Stick with mis-named concepts or rename them in wrapper code?

I'm writing a library which includes some wrapper code for some underlying API. In that underlying API, there are two concepts, "foo" and "bar", whose literal meaning in the English dictionary is ...
0
votes
1answer
97 views

Is using web sockets between client-server to tranfer files the right approach? ( when multiple users connected on the same socket connection )

I am currently designing a system that lets users connect their Cloud Storage such as Google Drive, Dropbox etc and also to their physical filesystem (personal laptop/ ftp server etc.) and then can ...
1
vote
3answers
116 views

How to design a stable API for a progress display function?

Task Description I need a way to wrap different types of progress bars in a way that an algorithm can update the progress without knowing about the exact implementation. The progress implementation ...
2
votes
1answer
64 views

Delegating authorization across multiple API's

I'm building a multi-tenant system that consists of one (SPA) client, calling multiple API's, all under my control. User authentication is done with OpenID Connect, I'm sending an ID and access token ...
-1
votes
1answer
99 views

Should an API be designed so that all information needed is returned in one request?

I'm currently designing my first API and I had a question: Should an API return all information about an object and its foreign keys? To explain the above a bit better, this is a part of the ...
0
votes
1answer
82 views

Microservice Architecture auth design

As a learning exercise I want to develop a system using microservices. I have designed my authentication/authorization architecture and would like to know if there are drawbacks to my design. It is ...
1
vote
1answer
77 views

external API in three-tier architecture?

I am making a data visualization application in Unity game engine that simply shows data in a 3D environment using google maps API. I am using the three-tier architecture to explain the application. ...
1
vote
1answer
116 views

Why not OData in public business APIs?

I hope I'm directing this very general question to the right audience. If not, don't hesitate to redirect me elsewhere is possible. I'm part of an initiative at a large company that is starting its ...
0
votes
2answers
140 views

Microservices based API, how to handle long lists requests

I was planing to create an API based on microservices, I'm stuck on how to solve a specific scenario. Initial plan is, all microservices are only accessible through a REST API. Based on the next ...
-3
votes
1answer
33 views

Best Practices for Building An API and SDK for a Legacy Application

I have been given a task to take on a legacy application (which has a very poor API in terms of user experience, is undocumented largely, and performs slowly) and build a new API and SDK to improve ...
1
vote
0answers
38 views

How can I decouple my wrapper API from its underlying SOAP implementation?

In our current architecture, a user has multiple ways they can change an address (as an example). They can do it through an online portal, through our core processor directly, or via a number of apps ...
7
votes
8answers
391 views

Should a function throw exceptions based on its expected behavior or its goal state?

My coworker and I are debating the correct design for an API. Say we have a function void deleteBlogPost(int postId). What should this function do if the blog post indexed with postId does not exist? ...
2
votes
2answers
134 views

Combining PUT and POST on the same resource

I have the resource OrderRequest which I guess can be qualified as process. The OrderRequest can be create of update. The create should be idempotent, because creating the same order request 2 times ...
10
votes
3answers
454 views

API endpoint POST vs GET

Help me settle an internal question. We have an endpoint which we all agree should be a GET, because all it's doing is calling a stored proc and returning a set of data. However, there is a set of ...
1
vote
1answer
40 views

Determining the service calls within the API based on the each consumer request

Currently, I have a rest API service which serves to many different consumers. One of the endpoints of API is for retrieving an order. Inside a single application, I am making 5 different service ...
4
votes
5answers
132 views

How to designing API JSON Response with nullable fields

We were discussing how to design a API response, for simplicity, think of having to give information of all the different types of facilities available in a city: { "city": { "cityName": "...
1
vote
3answers
62 views

What http error to return in case of validation and business rules in a domain driven design api

I have a .net core api trying to implement it according to domain drive design principles. In the domain layer there is a public Create method that contains all validation and business rules. If one ...
0
votes
3answers
99 views

RESTful API design using HATEOAS - Decision on Structure

We're designing and developing an enterprise application using Spring Boot for REST APIs and Angular 8 as the web client. It's been an year since we started. When I started, I read multiple articles ...
0
votes
0answers
32 views

How do I properly secure a Spring Boot app serving server-side rendered pages and API?

I'm wondering how do I properly secure this example app (https://github.com/brunodrugowick/spring-thymeleaf-vue-crud-example). The app is: A Spring (Boot) app with server-rendered pages via ...

1
2 3 4 5
17