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
2answers
45 views

Should I return user data in an authentication endpoint using JWT?

I implement an auth endpoint which takes an email and password and returns a JWT token. Inside the JWT there is a payload containing the user ID. Does it matter from a REST/JWT standards perspective ...
0
votes
2answers
51 views

Setting custom callbacks in a Javascript applet?

I'm designing a 3D visualisation applet in Javascript. When used, a Canvas will be created and placed inside an HTML element on a webpage, specified by the developer who is implementing the applet. ...
1
vote
1answer
43 views

Manager node makes HTTP request to self?

I am working on a distributed application that uses the Manager Worker pattern. The application's manager node submits work to worker nodes through a WorkerNode object (allowing WorkerNode to be ...
-1
votes
0answers
90 views

What should we consider when designing a load balancer with minimum cost

Given a set of processes running on a cluster of hosts, I'm designing a system that load balances the hosts through live migrations (carried out by an external service) of the processes. The goal of ...
2
votes
1answer
76 views

Design that hides cache as an implementation detail

I have a type which is fairly heavy (maintains an off-heap object), and which can be uniquely derived from a String. It requires cleanup, so of course the type has a close() method, but it is used in ...
2
votes
3answers
124 views

Good ways to prevent client side logic duplication without HATEOAS?

I know HATEOAS can be a bit of a heated topic. Some people like it, some people don't. That is not what I want to discuss. What I want to discuss is what technology other than HATEOAS (or some form of ...
1
vote
1answer
49 views

Handling multiple REST API versions in one codebase

I have a REST API (v1) which routes through to a Java springboot component for which I now need to introduce a number of breaking changes to add new and changed functionality (v2). I understand how I ...
1
vote
1answer
129 views

C#: Should I define methods as async?

I have a C# (WPF) application which consumes a particular 3rd party API/tool (let's call this Tool A). My colleagues and I are trying to decouple that from our application, so that it is possible to ...
0
votes
1answer
34 views

Checking caller has access to an API resource - Design

We have an api that looks like this https://ourapi.com/api/managers/-/staff, that will get a list of staff that the currently logged in manager has been granted access to. It is the Managers service. ...
0
votes
1answer
40 views

Normalize timestamp values or have multiple SQL queries

I have a Spring Boot application to implement a RESTful API. One of the GET requests have two query parameters: from and until (of type date). Those parameters are optional, so user-agents can send ...
0
votes
1answer
55 views

Logging microservice - error level in URI or body?

For my use case I need to create a microservice that receives log messages through HTTP. I'm wondering about the reasons to pick either of these: Method: POST URI: /{logLevel}/ Body: { "message&...
0
votes
1answer
81 views

RESTful API design when a “resource” is split between storage locations

Let's say you have a database-credential resource that stores a few things: whitelist of IPs that can connect connection password for the user When GETting / POSTing these, should they be under one ...
0
votes
1answer
47 views

IOT data interpretation

This is a more architectural question and I am hoping to get more ideas out of this thread. I have a computer vision model detecting daily life activities and sending data to the server every second. ...
2
votes
1answer
116 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 ...
1
vote
1answer
105 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 ...
-1
votes
1answer
33 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 ...
0
votes
3answers
61 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 ...
1
vote
5answers
293 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 ...
-2
votes
1answer
122 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 ...
0
votes
2answers
44 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 ...
0
votes
1answer
79 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 ...
-2
votes
3answers
326 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 ...
1
vote
1answer
63 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 ...
1
vote
1answer
46 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 ...
2
votes
0answers
28 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 ...
-1
votes
3answers
74 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": "...
1
vote
1answer
70 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 ...
1
vote
1answer
69 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 ...
-1
votes
1answer
46 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 ...
1
vote
4answers
91 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 ...
0
votes
2answers
66 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-...
21
votes
9answers
6k 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 ...
1
vote
1answer
81 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 ...
3
votes
1answer
164 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 ...
-1
votes
2answers
165 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, ...
1
vote
0answers
40 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 ...
0
votes
1answer
121 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 │ └ ...
2
votes
1answer
95 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 ...
1
vote
1answer
83 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
50 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
95 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 ...
39
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) ...
1
vote
0answers
56 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
30 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
74 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
113 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
99 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
40 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, ...

1
2 3 4 5
19