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
0
votes
1answer
56 views

RESTful Response when the POST request results in the creation of different kind of resources?

I have been working on designing an API that lets client create a product (think of product as something like website domain, something that comes into existence when client makes order for it to the ...
3
votes
1answer
209 views

Design Error Codes Flow In Microservice

I'm designing an application in a micro-service architecture and I have some questions regarding error codes. Found some information about it (1,2) - but more focused on the responsibility of the ...
1
vote
4answers
128 views

Should you validate route parameters or let them fail with a 404?

So this is an example endpoint to fetch one user by its username [HttpGet("{username}")] public async Task<ActionResult<object>> GetUser([FromRoute] string username) { // ... ...
0
votes
1answer
33 views

Photo Library Service: What should be right way of photo library using AWS S3 and Java

I want to make a service that is supposed to upload Photos in S3 and make them available using a link. I have few design plans for my service. PLAN 1: Upload photo to my REST API which will update ...
0
votes
2answers
63 views

User-friendly parameter parsing from yaml

Problem I have designed an evaluation tool (in python) and need some help to make it more user friendly. The tool requires ~100 (nested) parameters, which it gets from a yaml file and stores ...
0
votes
1answer
27 views

Controller responsibility to support methods with association

We are designing an API with multiple controllers and having discussion on where should we put one of the functionality and which controller should take responsibility to hold that. Will try to ...
1
vote
1answer
48 views

Designing API to model existing Excel “stateful” application

I currently maintain an Excel file that has ~20 inputs which is used to modify thousands of simulations. What I'd like to do is expose the inputs as API endpoints for both analytical developers and ...
0
votes
2answers
45 views

API versioning at BackEnd - Declare the versioning(v1) at global level or at each controller/method level?

If I keep versioning at the global level then it would save the clutter at each controller level, // main.js main() { registerGlobalRoutesPrefix("/api/v1"); } // controller1.js @Route("controller1-...
3
votes
2answers
169 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
46 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
314 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 ...
1
vote
2answers
108 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
47 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
33 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
104 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
66 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
70 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
230 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
36 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
47 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
96 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 { "...
1
vote
0answers
74 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
61 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
69 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
74 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
64 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
44 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
48 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
39 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
62 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
86 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
42 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 ...
1
vote
2answers
120 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
63 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
60 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
79 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
54 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
50 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
336 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
122 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
124 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
75 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
102 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
98 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
164 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. ...
2
votes
1answer
180 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
184 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
35 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
39 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 ...

1
2
3 4 5
19