Questions tagged [api-design]
API design is the process of determining and exposing a set of consistent method signatures, return values, and documentation intended for use by other developers to allow programmatic access to data.
2,230
questions
-1
votes
0
answers
28
views
REST API naming standard for an aggregate entity [closed]
I have an employee entity (Spring Boot) for which attendance is captured daily in an another entity named employee_attendance (this has a relationship to the employee and calendar entity).
GET /...
0
votes
1
answer
25
views
Best way to identify user roles in an api
I am currently building an API in which users can access resources including theirs publicly, as well as manage it in a dashboard.
In the spirit of having a single resource endpoint to prevent code ...
0
votes
0
answers
16
views
What is the recommended way on keeping a Database at REST these days via NodeJS?
I am just getting my head round better-sqlite3-multiple-ciphers to encrypt
a sqlite db on the file system. I am also thinking about using Argon2 to
encrypt the relevant fields... As this will be ...
-1
votes
0
answers
16
views
API Design questions [closed]
I currently work on a project that involves 3 entities.
A client (service, agent):
It would be installed on machines (servers mainly) owned by users of the service, fetching metrics from the machine ...
-1
votes
0
answers
45
views
Recommended Architecture for large API clients in Flutter? [closed]
Trying to implement a large API client and split it into multiple parts in order to keep it clean and maintainable. I'm now questioning myself, what's the best architecture for a large API?
Approach 1:...
0
votes
0
answers
11
views
Debug API requests in Spyder
I have a local API call, which uses some of the .py code.
But unfortunately, the debugging is not working, it does not come to the breakpoints, simply run the entire code.
Here would be an example of ...
0
votes
1
answer
38
views
RESTful API: What's the best path specification for bulk write operation?
Imagine that we are designing API layers around a data object called person
I know that in RESTful API:
a "create person" call should have path be like:
PUT https://server-host/persons/<...
0
votes
3
answers
46
views
Are there any standards for APIs (like EDI), like message for placing order, retrieving prices, stocs, etc?
I'm about to design a (REST) API for a custom ERP solution. The API will then be connected to some EDI solution.
Are there some standards, common message format for contracts like placing orders, ...
0
votes
1
answer
29
views
Design of REST methods for both deep and shallow insert options
We are designing REST API and having course and student entities:
course includes multiple students
multiple courses may share the same student
when creating course one should be able to both include ...
0
votes
0
answers
39
views
OAuth credential management
I am new to API development and iI encountered a situation that made me question some of the practices in API development.
The context is as follow, I have a web application where users can register ...
1
vote
0
answers
39
views
Node js Web api doesn't send an error if the price is lower than 0
I've recently created a simple node js web api which is connected to a MySql database, in my database I have a price parameter which has to be equal or more than 0, I added a check into my product....
0
votes
2
answers
115
views
How to handle both 0/1 and false/true values for booleans in requestbody
I'm currently migrating functionalities from an old HTTP API to a new HTTP API.
Several endpoints of the api expect objects with nullable boolean values as a JSON object in the requestbody.
Modelcode:
...
0
votes
0
answers
31
views
Error sending object to API using angular, registration method with template string and post method to server
I created a registration service in my angular application but I came across an error that puzzled me, I've done some research but I still don't understand the reason for the error even though I've ...
0
votes
1
answer
56
views
How to design a REST API endpoint with relations
I'm working on designing a RESTful API, and I'm facing a challenge when it comes to modelling and implementing endpoints for entities with many-to-many relationships.
Example:
The Role table stores ...
-1
votes
1
answer
53
views
Do I need to host ASP.NET Core API on a web server to join it on Production environment?
I've got an API that I'm running on a raspberry, I configured the application to listen on a port of this machine which I'm sending HTTP requests on with my PC on the same local network with :
http://&...
0
votes
2
answers
43
views
Prevent React Component From Calling API Endpoint Twice
I have a POST endpoint that creates an instance on the database once the user creates an account, the rows are filled with information like day of the week, date, user_id, etc.
@api_view(['POST'])
def ...
0
votes
1
answer
34
views
How do I use an API endpoint to call another API endpoint using Django REST Framework?
For context, I'm creating a feature on my app that allows users to delete their account, but first they need to validate their info like username, password, and type the string 'delete'. So for this ...
0
votes
1
answer
32
views
How can public APIs be secured?
I'd like some help to understand how a public API can be secured.
I'm building a cloud service, which offers a SaaS app, that is my core product and is now ready. But I also want to give the users the ...
1
vote
1
answer
33
views
Searching for the best practice making REST APIs [closed]
I'm currently working on the back and the front of a web app as a fun project and found something that made me ask myself question, what is the best way to return in an API a result that is wrong.
For ...
1
vote
0
answers
68
views
How to Include Metadata for Individual Fields in a multipart/form-data Response?
I have an API developed in Java 20 and Jakarta EE 10 with the Wildfly server. In this API, I can create multiple BatchTechnicalRecordAttachments at once. Each BatchTechnicalRecordAttachment is ...
0
votes
1
answer
58
views
How to keep an authorization server in sync with an external database? [closed]
My current system looks like this:
Authorisation Server (AWS Cognito User Pool) containing user info (id, username, email)
MySQL Database containing non-auth related user info (eg. friend connections)...
0
votes
0
answers
32
views
Connect a API with a index.html through Gunicorn
I am trying to make work an app found in a public GitHub repository. It is an app created with Python that links an API with a WSGI HTTP Server (Gunicorn). When I run
set -x
NUM_THREADS=1
HOST=0.0.0....
0
votes
0
answers
32
views
Py code for API call using username, password and API endpoint url
I wanted to write a API call for downloading data from a CRM platform.
I only the below information:
API endpoint
Username
Password
Userid
I see two ways of doing the same:
Using Webhooks
get ...
1
vote
0
answers
18
views
DotNotation instead of hardcoded string for culture localization
I'm adding the localization in my C# web API server written in .NET6; the user can provide the culture in the URI, therefore I have added these routes in one of my Controller:
[Route("api/v1/user/...
0
votes
1
answer
37
views
Design APIs using HTTP methods [closed]
I was asked below question in Netskope system design interview. i.e. design APIs for below functionalities (full URL path with HTTP method) and I could not answer well so I was rejected. I could not ...
0
votes
2
answers
90
views
How to structure Laravel API resources folder properly [closed]
I wonder what are the best practices that the community have about the architecture of Laravel's Resources.
I started using it to avoid sending unnecessary data to certain routes of the API.
I ...
1
vote
2
answers
336
views
Should I use a query parameter or separate endpoints for different data access levels? [closed]
I have an API endpoint for retrieving articles:
GET /articles
This endpoint can be accessed by both guests and administrators. The distinction lies in the data that can be retrieved.
For example, ...
0
votes
1
answer
59
views
How to Check Permissions on List API Without Any Filters
I'm working on a List API that is supposed to return all objects the calling user has access to without needing any filters that would simplify the permissions checking. The permissions model is a bit ...
2
votes
1
answer
244
views
How can you safely change a protobuf "oneof"?
At some point, we (regrettably) defined a protobuf type like this:
message Parent {
oneof foo_or_bar {
Foo foo = 1;
Bar bar = 2;
}
}
What I want to end up with is something like
message ...
1
vote
1
answer
18
views
Is it a security issue to include postcode and/or last name in a query string?
I'm currently designing an endpoint to validate a customer, and they can either pass in their postcode or their last name, as well as their customer ID (plus some other irrelevant data).
I've heard ...
0
votes
0
answers
56
views
How can resolve the limited API number per second about the Debank API on the nest.js?
I am trying to develop the back-end API using Nest.js and Debank API but I found Debank API is limited about the calling number per second. But I have to call a lot of API per second. How can I ...
0
votes
0
answers
166
views
Laravel Passport how to pass the access token to js?
I would like to ask how can I get back the accessToken from current user?
Background: I would like to develop an API that requires authentication of users.
Now, I am able to create the accessToken by:
...
0
votes
2
answers
310
views
How can you distinguish between a standard library call, a third-party library call, and an API call from the repository?
I am working on a project where I have to determine whether a particular call or import is:
From the standard library of the language (Python) I'm using. (I am already considering to use sys....
0
votes
2
answers
172
views
How should I structure modules in a large python application?
I often write and participate in the development of web applications in Python together with FastAPI. I always use the same folder structure which is as follows:
I think the names are clear to know ...
0
votes
1
answer
48
views
Express Connection With MongoDB and Designing APIs
var express = require("express");
var cors = require("cors");
var mongoClient = require("mongodb").MongoClient;
var connectionString = "mongodb://127.0.0.1:27017&...
-1
votes
1
answer
27
views
API URL Design - query or path parameters [closed]
We have a model where Object A is one-to-many with Object B.
We have an API where we want to get object A by it's Id so we have the URL /objectA/:id. That's fine and seems pretty standard.
We also ...
0
votes
3
answers
203
views
When building a REST API, must I use status codes?
I'm developing a web application that has a backend API, which is going to be primarily used by a reference frontend application, but other clients can use it too.
The data my API sends has a specific ...
0
votes
2
answers
41
views
Is it possible to create an API endpoint in REST API if the resource is not an entity? [closed]
I am developing an electronic salary diary application. On the backend, I have "entries" entities with "Date" properties.
Now I have a react application that takes all the entries, ...
0
votes
1
answer
74
views
Finding Current, Logged in userId
I want to access userId of a user who is currently logged in in ASP.NET Core 6. I tried many different approaches, but all of them seem to have one problem: user is always null.
I tried this
string ...
0
votes
1
answer
57
views
Global rules for API [closed]
I am Developing a backend of an web application, I want to create something like global rules for user authorization for example:
user() has edit to org() if user.id == org.owner
this means every ...
1
vote
0
answers
28
views
Do streaming http responses need to ping the browser to prevent the connection from being closed?
I am implementing an API over HTTP that provides a slow streaming responses that may have lengthy gaps between chunks being sent. I'm trying to figure out if I should implement ping responses to ...
0
votes
1
answer
56
views
Best practice for REST api handling embedded documents
My backend manages one entity (EntityA) containing a second one that it stores as an embedded document (EntityB).
What is the best approach when it comes to design a REST API for consuming EntityA?
...
0
votes
2
answers
100
views
Why is this bad API design?
We have a single .NET API that manages all requests for multiple applications. The API uses System.Data.SqlClient to speak to the database rather than using an Entity Framework "bridge".
Its ...
2
votes
2
answers
82
views
How do REST APIs handle paging efficiently?
I am working on a REST API that potentially could return a lot of data, and one solution to limit the size of responses that I am considering is including paging in the returned data. So we return say ...
2
votes
0
answers
23
views
How to architect the code if there are multiple database update mix with third party API calls
If my code are like this
start transaction
first database update
first API call
second database update
second API call
third database update
third API call
end transaction
The rough idea is that all ...
0
votes
1
answer
60
views
Designing a microservice API for delayed response in complex calculations with request concurrency control
I would appreciate it if someone could guide me towards the best approach to implement this idea:
I have a microservice (perhaps an imprecise description) that acts as an API provider for a specific ...
0
votes
0
answers
175
views
Satisfy create, update and delete operations in one rest API request
I have many thoughts about how to design an API, do not know exactly what is the best practice to follow and would need a bit of help picking the correct approach.
Suppose that in a Mongo database ...
0
votes
0
answers
27
views
How to do access management with this architecture?
I am working on a system with the following architecture structure (relevant to the question):
Frontend server (static assets + proxy API calls + sessions management)
API server + domain specific ...
2
votes
2
answers
54
views
REST API convention for updating 2 different resources in a transaction manner
I have a REST API with multiple resources. There is a scenario where two different resources should be updated. These two have one-to-one relations and must be updated transactionally.
Let's say we ...
0
votes
2
answers
84
views
Best way to handle multiple APIs with the same output type in single one in ASP.NET Core using GetRequiredService
I have several Get APIs that return the same type of output, and I am attempting to create a single method to support all APIs requests instead of multiple APIs . To do so, user sets the name of ...