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

API development - Exposing new version VS updating current version

Context There is a back end and a front end team. Back end exposes an endpoint to the front end app: PATCH car/{carID}/tire Problem I want to update the aforementioned PATCH request functionality ...
Cap Barracudas's user avatar
2 votes
1 answer
174 views

Building a Microservices App -- Can you give feedback on architecture?

I did some googling, and I was directed to Software Engineering to ask architecture questions. If you know of a different forum that could help me, please direct me to it I recently started learning ...
Asool's user avatar
  • 129
-1 votes
1 answer
41 views

Opinions on using standardized J2EE APIs over specific over vendor APIs

I have always advocated the use of standardized api, and currently use it on my code. However i always get very strong resistance when it comes to code review, even on projects i have designed and ...
user3414321's user avatar
0 votes
3 answers
1k views

REST API path parameter with multiple meanings

I have an API that manages projects. You can get a single project via this endpoint, where {id} is a numeric project ID: /projects/{id} Each project can have one or more tags. Now I want to add an ...
Aurast's user avatar
  • 173
3 votes
5 answers
2k views

What http codes should i return when user request file which doesn't meet his requirements

i have a case where user can filter and download multiple pdf documents merged into single file. The client should display an error message when no document's meets the filter, and ask for ...
Kamil Bęben's user avatar
-2 votes
1 answer
132 views

When writing code to consume an external API, should you default to production or testing?

I'm currently writing some code to interact with an API that doesn't have any official libraries. The provider has given me two sets of credentials - one for testing and one for production. I'm ...
Kayla M.'s user avatar
1 vote
2 answers
416 views

How to cache duplicate fetch and save calls that are fired within the same second

I have a service which provides an endpoint that fetches from another service, saves, and returns an record. Here are the details: The caller calls the endpoint using an identifier (say a customer's ...
Wenduo's user avatar
  • 19
0 votes
1 answer
300 views

Should an http API client hide the http response object?

I'm using a client library for an HTTP API. The client exposes objects and methods matching the domain, e.g. Api::Document.download, but the return value is just the http response from the API. As the ...
iftheshoefritz's user avatar
-2 votes
3 answers
1k views

RESTful API User Accounts

I'm trying to expose RESTful API endpoints for creating user accounts to access my API. So, this would be one of the first things my consumers would use. I'm trying to figure out if this is how I ...
ProgrammerNewbie's user avatar
1 vote
1 answer
243 views

Correct format to receive datatime data from consumer

I am working on a service in a sprint boot microservice application. The consumer for my service can be another service, as well as a UI component. The are 5 entities in my service, each entity having ...
rsp's user avatar
  • 143
1 vote
1 answer
968 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 ...
abdusco's user avatar
  • 119
2 votes
0 answers
287 views

Reading (GET) Facebook Ads From Ad Library and Reading (GET) Personal Ad Account Billing Data in my Android Application

I'm trying to create an android application for personal use to do the following: Get ads from the Facebook ad library (commercial ones) not the ones with politics topics etc. and then insert them ...
Rany's user avatar
  • 121
-1 votes
3 answers
547 views

best practice posting complex object to api

i am trying to figure out what is the best practice on doing POST calls when creating new complex objects. example assume this is the complex object i wish to send: { "firstname": "...
Aeseir's user avatar
  • 247
1 vote
1 answer
151 views

Consuming complex JSON service that does not have schema

Hi I have this weird situation where I have a JSON producing service that represents a very complex object graph and this bject graph does not have a JSON schema that it is based on. The reason for ...
Alexander Petrov's user avatar
1 vote
2 answers
463 views

How to manage huge chunks of validation data inside a REST API?

TL;DR What are common practices to separate validation logic inside a rest API & thereby keep the code clean and straight forward? (code example) Context & Example Let's say I'm developing a ...
Michiel's user avatar
  • 163
-1 votes
1 answer
63 views

How to design API endpoints for resources that relate on eachother?

I am developing REST API using node.js and Express. I have Houses collection and Rooms collection. Every Room belongs to exactly one House for it's entire lifetime. I'm not sure how to design API ...
kazulla's user avatar
1 vote
4 answers
168 views

Replace Rest verbs with custom object to drive resource operations

One of my clients has a Restful API on which I'm supposed to work on that only exposes two verbs: POST and GET. The POST endpoint is used in lieu of the standard Rest verbs: PUT, DELETE, PATCH. The ...
Luciano Fiandesio's user avatar
0 votes
2 answers
189 views

Structuring optional REST resource hierarchy

I am designing a REST service with multiple end points which will be servicing the following hierarchy: Department has many Category Groups Category Group has many Category(-ies) Category has many Sub-...
linuxNoob's user avatar
  • 183
22 votes
9 answers
8k views

Declaring that a function never returns

If I have a function that never returns (it contains an infinite loop) how do I declare/communicate that it will never return to the user of the function? The user does not see the source code, only ...
Fred's user avatar
  • 489
1 vote
1 answer
169 views

REST : Static API design

Lets say, I have a scenario where I have to expose an api to fetch supported shirt sizes(small , medium and large) My initial thought was /v1/shirts/sizes - But this clashes with the existing fetch ...
Jeevi's user avatar
  • 159
4 votes
1 answer
845 views

Where should the circuit breaker go?

I'm developing a new REST API and I've seen some projects place the circuit breaker in the Controller. I used to place it in the DAO. First difference I can say is that placing it in the DAO is that ...
Quarktum's user avatar
  • 143
-1 votes
2 answers
363 views

Achieving server-side rendering of data coming from a PHP API

I have been working on a blog application with Codeigniter 3.1.8 and AngularJS v1.7.8. It is intended to be versatile and easy to use. The Dashboard of the application is "pure" Codeigniter, ...
Razvan Zamfir's user avatar
2 votes
1 answer
587 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 ...
IamMowgoud's user avatar
4 votes
2 answers
2k views

How to manage database changes and sync data with multiple api versions

We're working with ASP.NET Core web API and looking for a couple of doubts that we have. The versioning documentation recommended creating multiple controllers: Contoso └ Api ├─ v1 │ └ ...
Div's user avatar
  • 167
2 votes
1 answer
791 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 ...
Katie's user avatar
  • 239
1 vote
1 answer
356 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 ...
Countach's user avatar
  • 113
1 vote
1 answer
264 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 ...
ClicheCoffeeMug's user avatar
1 vote
2 answers
124 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 ...
LoveProgramming's user avatar
42 votes
1 answer
8k 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) ...
meci's user avatar
  • 531
1 vote
0 answers
126 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 ...
Pepria's user avatar
  • 119
0 votes
2 answers
76 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 ...
sync101's user avatar
-1 votes
1 answer
406 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 ...
NeoChiri's user avatar
  • 155
-2 votes
1 answer
660 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 ...
Corcus's user avatar
  • 143
1 vote
1 answer
568 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> &...
Christopher Francisco's user avatar
1 vote
0 answers
190 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 ...
Daniel Hoppe Alvarez's user avatar
-1 votes
2 answers
1k 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> ...
Rui's user avatar
  • 1,699
5 votes
4 answers
3k 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 ...
Rui's user avatar
  • 1,699
0 votes
1 answer
273 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 ...
rohanagarwal's user avatar
0 votes
1 answer
337 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 ...
Aditya Kumar Gupta's user avatar
3 votes
1 answer
3k 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 ...
sborpo's user avatar
  • 153
1 vote
4 answers
2k 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) { // ... ...
Question3r's user avatar
1 vote
2 answers
128 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 ...
Kuldeep Yadav's user avatar
0 votes
2 answers
490 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 ...
gebbissimo's user avatar
0 votes
1 answer
35 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 ...
Sandeep Polavarapu's user avatar
3 votes
1 answer
57 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 ...
Tony's user avatar
  • 169
0 votes
2 answers
230 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-...
Vishal's user avatar
  • 9
3 votes
2 answers
949 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-...
Code Name Jack's user avatar
0 votes
4 answers
892 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. ...
hatella2's user avatar
3 votes
1 answer
4k 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 ...
isuckatprogramming's user avatar
1 vote
2 answers
1k 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 ...
Tarek B's user avatar
  • 119

1
4 5
6
7 8
23