Questions tagged [api-design]
Application Programming Interface (API) Design discusses best practises for creating libraries intended for general purpose or public use.
1,125
questions
6
votes
3
answers
866
views
How to simplify exception handling for library users?
Suppose of having a library exposing the following piece of functionality:
public static class AwesomeHelpers
{
public static async Task<int> ComputeSomethingImportAsync(CalculationInputs ...
-1
votes
1
answer
70
views
How do I authenticate API request when I dont have credentials for the other end
I am developing an app in which I have to fetch data through company provided APIs. All the authentication is done on their end, so I don't have to build my own APIs.
However, There are some ...
0
votes
3
answers
538
views
Should I separate the public and private portions of an application into two separate apps?
So I'm currently running an analysis task for my company. I won't go into too much detail but we are dealing with medical records and other confidential data. Previously this application was only used ...
2
votes
1
answer
99
views
What is a good approach to handle editing product images?
You have the following situation:
You have an SQL database containing two tables product and product_images
You would like the user to be able to add, remove, or move around existing images
They can ...
3
votes
2
answers
434
views
parameter longer than the length limit of GET into a RESTful interface
In a Restful API, it is better to use GET to list a collection. However, in our scenario, we allow people query with a list of parameters (say CodeList) and then return details.
As we allow upto 500 ...
2
votes
1
answer
197
views
Best practice for designing a WebAPI for exposing data in a SQL database interacting with C++ and C# applications
I am looking for general guidance or any relevant links for a complex project.
We are a small business that sells a construction materials testing software. The client is a Windows application with ...
1
vote
2
answers
167
views
API for input stream operation read until
I want to create a stream class The input stream should read/parse a continuous range from left to right providing convenience methods. The implementation isn't a problem but choosing a consistence ...
1
vote
2
answers
1k
views
How to effectively handle a large API call
I have an API call that returns products to be displayed on a Point-of-Sale system. the current account I have has about 7000 products.
Initially I made the API return all products at once, this works ...
0
votes
1
answer
197
views
How to design a rest api for updating collection(ArrayList) of Resource in Spring boot?
I have a resource called Client and it has the following attributes id, name, redirect URLs(ArrayList).
class Client{
int id;
String name;
List<String> redirectUrls;
}
I have all CRUD ...
0
votes
3
answers
105
views
Handling multiple possibile response types in API design
I have an app which uses barcode scanning to gather information about fruit.
A barcode could be bound to either an Apple or a Pear: the app asks a remote API which one is it, and then stores the ...
0
votes
1
answer
404
views
How to define API notations for multiple tables data in the response
The question is specific to the API notation shown in the screen under the heading Table Name with the comment Joins Multiple Tables. I am using Spring Boot with JPA (Database: RDBMS)
I have defined ...
0
votes
1
answer
119
views
Who to manage AAA , gateway or business service
In a debate with our solution architect, there were 2 proposed solutions to handle (illustrated below on the figure)
In the first, the API Gateway manages Authentication, Authorization and Accounting ...
1
vote
0
answers
83
views
Request and response validation
I am currently working on a project using Flask to make REST apis, blablabla. But, working with request validation tools that we use, I am thinking of whether it would be necessary to validate the ...
1
vote
1
answer
84
views
Centralizing vs decentralizing of rounding-off and summation of data
Let's say there is a database that persists transaction data , e.g transaction items list of sale invoices , in raw format. Something like this
InvoceId
Item
Price
1
Product-1
2.8592
1
Product-2
...
0
votes
1
answer
84
views
API controllers modeling
I'm developing an API with ASP.NET, but I'm having some questions about the best way I should develop the controller layer for the products.
I'm having these questions because each product will have ...
0
votes
2
answers
264
views
Low level C driver API
Recently I had my first experience writing a wrapper around FTD2XX driver for a desktop tool that communicates with an embedded device. The library provided some common device specific functionality ...
0
votes
3
answers
1k
views
How to design RESTful API for response object properties dependent on request parameter
I have a RESTful service where clients provide product codes, start date and end date. In response, the service returns a list of price metrics for the products over the date range. Start date is ...
2
votes
7
answers
1k
views
Representing a large list of complex objects in JSON
I am currently developing an API that returns JSON structures. One of the domain objects returned is a time series, which is a potentially large list (many thousands of elements) of complex objects.
...
0
votes
3
answers
177
views
Should the client silently fix a possible error or should it let the user of the client know about the error?
I'm building a client for an API.
The API takes a query param that looks something like this 2-10, that's a range and notice that it uses a hyphen (-).
Usually, data comes from another place using en ...
3
votes
2
answers
2k
views
Communication between two apps
I am thinking of creating two applications, one of which (App 1) will be in Django (DRF) and other (App 2)might be Django but might be another more lightweight framework (maybe Flask or plain Django ...
-1
votes
2
answers
239
views
Enum and Programming to Interface and best practices
I am learning stuff and have made 2 microservices, Listener and MyApp. Listener is a jms listener (consumer of messages) and MyApp is the app sending messages to queue.
I have 2 type of events CREATE ...
0
votes
2
answers
932
views
Move from mft to api REST style to get or post large data 200mb , is it best practice?
I am designing the API architecture for my client:
My client actually exchange huge files (csv) with his Partner with MFT ( SFTP )
**Partner ==> MFT ==> Client **
The requirement is to move to ...
0
votes
1
answer
480
views
Expose or consume API REST?
I am preparing the software architecture for my client project based on APIs REST
The idea is that any data exchange between my client and his partner will be via API REST call
The specification is ...
0
votes
2
answers
110
views
Designing an API where an image can be supplied
I am designing an API whereby some other system can supply an image in their POST. As such this is an API for integration purposes, with no front-end. Postman is used for testing the API.
Below is the ...
-2
votes
1
answer
269
views
Recommended way of caching weather information
I'm developing an application that will show some weather information based on the user's location. Since the weather forecast is just a very small feature of the app that complements the main ones, I ...
4
votes
2
answers
3k
views
Should I return always a JSON for only one value in a REST API or is it ok to return just the value?
For example, I create an API endpoint that provides the next available label for creating some items, so I call it like this:
GET /api/v1/get-next-label/
Is it ok to return just:
LBL-000001
Or is it ...
1
vote
1
answer
78
views
Intuitive RESTful API design for logistics shipments availability, accept, allocation decision?
I am trying to model APIs for
Create shipments
Fetch Available shipments (based on region preferences)
Accept shipments (allows logged in user to accept multiple shipments on first come first serve ...
1
vote
3
answers
243
views
Should Source Generators be used for managing optional dependencies
Let me try to clarify my question with an example. Assume a library of some sort which has a built in logging system and it is published as Library.Core. As the maintainer you want to add a wrapper ...
3
votes
1
answer
2k
views
REST: How to "upsert" a resource without an specific resource URL
I'm trying to create a REST API that allows the user to:
create a resource if it doesn't exist.
update a resource if it exists.
with the same request.
Given an example: I have a company that has ...
4
votes
2
answers
133
views
Why were the get/contains, remove operations on Collection and Map designed without generic types but add/put/ operations with generic type
According to the Java API documentation, the Collection<E> has:
boolean add(E e)
Similarly Map<K,V> has:
V put(K key, V value)
Among these methods, generic types like K, V, E are used ...
0
votes
2
answers
1k
views
How to handle validation errors from API response when using repository pattern
I've got the following:
Clientside C# application. Contains forms for CRUD operations. It uses an API for all data operations.
Input is validated on the client, and obviously also on the server (API).
...
3
votes
3
answers
766
views
Should our RESTful API be abstract or client-specific?
I work in the SAP industry where web-based UIs and RESTful APIs are a rather new thing, meaning some teams (like ours) don't have much experience in designing such systems. Recently there's been a ...
1
vote
1
answer
317
views
What design pattern to implement notifications for a .NET application?
I have an ASP .NET web application dashboard that is used to send notifications to several .NET desktop clients. The current implementation is that the web app writes the new notification to a ...
0
votes
1
answer
32
views
Getting sums of multiple leveled relations efficiently
I'm currently building an API and a web app for an internal warehouse system using NET Core.
I have the core entity structure, that goes like this:
"Material" has many "MaterialSubtypes&...
0
votes
1
answer
47
views
Validating REST API requests against previous requests as part of a larger process
I am building a REST API for warehouse inventory picking.
I have a very shallow understanding of REST, so to me that just == stateless and try to make your URL mappings nouns instead of verbs.
The ...
1
vote
3
answers
521
views
RESTful URLs for multiple resource in the same Microservice
We are developing a serverless application (AWS API Gateway, Lambda, and Dynamo) keeping users and groups in the same microservice as they are being stored in the same DynamoDB table. REST endpoints ...
0
votes
1
answer
111
views
Why do users and programs have different client authentication mechanisms?
Typically in any application, the way a user (human) is authenticated is using a username/id and a password, whereas programmatic or api based access is authenticated using API keys (based on system ...
0
votes
0
answers
365
views
JSON Api Relationships and DDD Principles
In my current project we try to use DDD as development process and foundation of our architecture. For the REST-Interfaces it has been decided, that JSON:API is our way to go.
Since DDD, REST and JSON:...
0
votes
2
answers
818
views
best practice for PUT requests in REST API
What's the best practice around updating information received from the request?
Update all the columns with the values received in the request object? What if there are columns that should be updated ...
0
votes
1
answer
363
views
How can I represent a graph for a visual programming language in JSON?
I am in the process of implementing a visual programming language similar to Blender's node editor or Unreal Engine Blueprints. It will be implemented as a SPA that will communicate with a JSON based ...
1
vote
2
answers
734
views
How to design asynchronous endpoints in a REST API
Context
Hi, in my job we are trying to modify an API endpoint (/resources) to make special queries to it. A resource has a location (long/lat) and we want to make queries based on that location. We ...
3
votes
3
answers
903
views
RESTful endpoints for returning same model based on different fields?
What is the recommended convention to be followed for identifying different GET endpoints that fetch the same model/entity using different fields/parameters?
For example, there is a Student entity for ...
1
vote
2
answers
437
views
Where to store credentials for a tird-party API in my API?
So my current app process works like this:
Client communicates with my API to get certain information
My API needs information from a third-party API and uses these to create a response for the ...
0
votes
0
answers
69
views
Simple Rate Limiting Logic
I have a requirement where I need to add some rate-limiting functionality to an existing web application. The application reads transactions from a queue (TXN queue) and processes them in realtime. ...
3
votes
2
answers
1k
views
One API endpoint for each frontend "need"
Let's say our web application handles "orders". An order can be displayed in several different pages of our web app, on each one, in a very different way.
For example: in page A, it shows ...
4
votes
2
answers
4k
views
REST API: POST and PUT for nested resources
I am wondering how to deal with nested resources in a REST API. I've seen other questions on the subject here, but I didn't find one that answered my question. More specifically, should POSTing/...
-2
votes
1
answer
39
views
Securing the REST APIs - Security Framework (Technology) V/S Custom
There are many ways to secure the REST APIs, from authentication and authorization view point. Below are the two which I know so far:
Using existing token based IAM solutions like Okta, KeyCloak, ...
4
votes
3
answers
2k
views
Email Confirmation links must be GET, but not safe
When a user signs up to a web app, they often get a confirmation email. This email will contain a link. Once the user clicks the link, the app confirms the user's account as correctly associated with ...
1
vote
1
answer
58
views
POST-ing lists of new resources to add/merge/remove
I am working on the backend of a web application that exposes a REST-like API to the frontend of the application.
Currently, I am exposing a "Users" resource, where each user can be ...
0
votes
2
answers
123
views
Start small - but design in such way that sharding is possible - how?
Following question is more about best-practices than a real problem - nevertheless, I'd like to know how to do it in best way.
Given a service, that can operate in multiple countries/geo-areas, one ...