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
0 answers
127 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 ...
user avatar
-1 votes
2 answers
374 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> ...
user avatar
  • 1,487
5 votes
4 answers
1k 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 ...
user avatar
  • 1,487
0 votes
1 answer
137 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 ...
user avatar
0 votes
1 answer
72 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 ...
user avatar
3 votes
1 answer
2k 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 ...
user avatar
  • 153
1 vote
4 answers
780 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) { // ... ...
user avatar
1 vote
2 answers
82 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 ...
user avatar
0 votes
2 answers
241 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 ...
user avatar
0 votes
1 answer
29 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 ...
user avatar
2 votes
1 answer
54 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 ...
user avatar
  • 159
0 votes
2 answers
122 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-...
user avatar
  • 9
3 votes
2 answers
492 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-...
user avatar
0 votes
4 answers
242 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. ...
user avatar
3 votes
1 answer
2k 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 ...
user avatar
1 vote
2 answers
714 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 ...
user avatar
  • 119
-3 votes
1 answer
97 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 ...
user avatar
0 votes
1 answer
294 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 ...
user avatar
1 vote
2 answers
79 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 ...
user avatar
  • 119
-2 votes
2 answers
74 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 ...
user avatar
5 votes
2 answers
716 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, ...
user avatar
0 votes
1 answer
125 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 ...
user avatar
  • 101
0 votes
1 answer
96 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 ...
user avatar
1 vote
1 answer
294 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 { "...
user avatar
  • 745
1 vote
0 answers
108 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. ...
user avatar
  • 11
0 votes
1 answer
80 views

Problems with software layers in complex query methods

I designed 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 ...
user avatar
-2 votes
2 answers
80 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. ...
user avatar
0 votes
0 answers
168 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 ...
user avatar
-4 votes
1 answer
201 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 ...
user avatar
1 vote
1 answer
382 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 ...
user avatar
  • 121
-2 votes
1 answer
170 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 ...
user avatar
0 votes
2 answers
136 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 ...
user avatar
  • 162
-4 votes
1 answer
83 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 ...
user avatar
  • 115
-1 votes
1 answer
415 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 ...
user avatar
1 vote
2 answers
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 ...
user avatar
1 vote
2 answers
168 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/...
user avatar
2 votes
1 answer
67 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 "...
user avatar
2 votes
0 answers
70 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 ...
user avatar
  • 21
0 votes
3 answers
585 views

Calling Microservice 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 ...
user avatar
  • 261
0 votes
2 answers
55 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 ...
user avatar
-1 votes
1 answer
133 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 ...
user avatar
5 votes
4 answers
351 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 ...
user avatar
  • 2,427
1 vote
1 answer
1k 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 ...
user avatar
  • 119
1 vote
3 answers
252 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 ...
user avatar
  • 164
2 votes
1 answer
320 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 ...
user avatar
-1 votes
1 answer
234 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 ...
user avatar
  • 117
-1 votes
1 answer
145 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 ...
user avatar
1 vote
1 answer
692 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. ...
user avatar
  • 21
4 votes
1 answer
740 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 ...
user avatar
0 votes
2 answers
324 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 ...
user avatar

1
3 4
5
6 7
22