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
1answer
81 views

What do you call the combination of endpoint and HTTP method in a REST API?

Let's use the Twitter API as an example. My understanding is that we refer to /statuses/update as an endpoint and we refer to POST as a HTTP method. So what would term do you use to refer to the pair ...
0
votes
1answer
71 views

Architecting multiple codebases calling our public API + private API for first-party applications

Currently, we have the issue where we have two codebases (API & Website) calling the same database (along with some duplicate business logic) and we want to streamline this so all requests are ...
0
votes
1answer
35 views

API / System Design [Flexible Authentication / Authorization]?

Background: We're a smaller shop that puts out a number of products that require authentication and authorization. We're currently using a 3rd party service to "spin up new auth APIs" for ...
1
vote
2answers
90 views

Is it reasonable to ask API consumer (client) to provide sync response to notification/callback?

We have an API platform which allows user to create and manage a certain type resource. Client is expected to provide a callback url where our server will send notification to when the resource is ...
38
votes
1answer
3k views

How to design a REST API that can “prompt” the client about long-running operations?

Say you were to develop a REST API that provides access to a set of complex, long-running, operations. The typical paradigm for an API like this (as I understand it) usually involves (the client) ...
-2
votes
1answer
95 views

What strategies should be used to reduce the necessity of breaking API changes? [closed]

When designing a library interface, what are some strategies to keep the API flexible, such that as it evolves it can avoid breaking changes as much as possible. I am asking specifically about Java ...
1
vote
0answers
54 views

Correct usage of ETags?

Currently my code makes a series of updates to some resource via a REST API but I also have some "rollback" logic that basically updates the resource to its original state before my updates ...
0
votes
0answers
29 views

When designing an API in Javascript with closures, should I provide singletons or factories for directly creating objects to clients?

I'm designing an API in Javascript part of an Angular with typescript project. I have involved later in this project implemented. There is a DataStorageService which I checked from git logs that ...
0
votes
2answers
48 views

Design Question: Reject Requests at Scale

Usecase: TeamA: Adds 5000 IDs to a blacklist per day and notifies other teams by publishing an SNS message per ID added that all other Teams listen to. TeamB: Gets 4K TPS to its API, and if a given ...
-2
votes
1answer
56 views

SRP for MVC controllers

I am trying to design an application that will be a REST API following MVC. For now ,I have 2 main features: Projects and Tickets associated to Projects. I would like to apply SOLID principles, and I ...
-2
votes
1answer
112 views

What is a good strategy to determine the maximum number or items an api endpoint should handle?

I am developing a REST api endpoint that accepts a list of item IDs and will return some details for each item. Let's make the following assumptions Performance wise in the DB there is no significant ...
0
votes
1answer
76 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
0answers
27 views

Socket.io behind api gateway

So the architecture I am currently working with, we have an api-gateway that gets all the requests and publishes them to our Eventsystem/ or directly to our essential services(auth, etc). Now we want ...
0
votes
0answers
24 views

How to structure/design a webapp using a large number of APIs

I am writing a webapp that aggregates a multitude of different APIs to gather data related to astronomy, and then returns the aggregated data in a single API endpoint. There are 7 API's being used, ...
0
votes
1answer
86 views

Is it a good practice to have an endpoint URL with path parameter accepting different type of values according to an indicator in the HTTP header?

Assume a resource URL in the context of REST API: /sites/<site id or site code>/buildings/<building id or building code> The value of the two path parameters, <site id or site code> ...
5
votes
4answers
435 views

Is it a good practice to have an endpoint URL with parameter accepting different type of values? [duplicate]

In my current maintenance project, there is REST API resource URL like this: /sites/<site id or site code>/buildings/<building id or building code> In this endpoint URL, there are two ...
0
votes
1answer
75 views

Microservices Conditional API Call Design

I always think about this scenario where we need to perform a task conditionally and the task requires calling another microservice. What I am not able to understand is which microservice's ...
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
92 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
122 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
32 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
47 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
40 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
151 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
45 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
152 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
90 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
46 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
27 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
101 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
69 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
220 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
33 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
92 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
71 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
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
72 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
47 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
37 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
45 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
50 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
2 3 4 5
18