Questions tagged [api]
An application programming interface (API) is the specification for which software is meant to be used by other software.
1,309
questions
0
votes
2
answers
108
views
Why did IHVs have never extended Direct3D through the facilities of COM on which it is based?
It is well known that Direct3D, unlike OpenGL, was never extensible in itself - a deliberate choice of Microsoft to favor the average user's expectations of predictable behavior and inherent ...
7
votes
4
answers
891
views
How to maintain consistency when retrieving partial vs. full data in an API Resource
I'm working on a API for the logistics department, and I have a resource called logisticTransport, which is an entity in our database. I'm facing a challenge with maintaining consistency when ...
-1
votes
2
answers
186
views
When is it okay to check and update state within a GET request
I have the following scenario:
We have a grid that allows the creation of reports. Report creation is asynchronous and happens in the background on worker nodes.
When a report is in the process of ...
-3
votes
1
answer
85
views
Mock an API for development purpose (no testing)
If I want to implement a connection from my software to an API, which is documented but not accessible yet, what is a common way to imitate the API until it is available?
My first idea was to mock the ...
2
votes
2
answers
103
views
How to Design a Secure Script for Conditional File Access Based on Time and API Conditions?
I want to create a secure script that grants access to files based on specific conditions. The access should be controlled by both time-based and API-based conditions. The script should only allow ...
0
votes
1
answer
88
views
Application plugin interface design
I build a plugin based Qt application which currently lives entirely in a library. The app as well as the plugins link to the library. The ::main(…) is just a tiny two line bootstrapper calling a ...
0
votes
0
answers
55
views
Utilising Social Logins via OAuth2 in native mobile apps
This question has been asked over and over again, but I have not yet found a satisfying answer:
How to use Social Logins (via OAuth2) to obtain access tokens for your backend if your only clients are ...
1
vote
3
answers
137
views
Who should build the RESTful client between two applications which both offer APIs?
Application A creates Widgets. Managers have decided that information regarding these Widgets is needed in Application B.
Application A has a RESTful API that allows client applications to pull data ...
1
vote
2
answers
206
views
CQRS: Multiple entry points for a single command
I’m trying to follow the Clean Architecture and CQRS within an application that, let’s say, create a product.
To achieve this, the application has 3 adapters, one for reading a file, another for ...
-1
votes
2
answers
219
views
Idempotency for a financial transaction API
Say you have a REST API endpoint like POST /move-money which transfers money from your main account to a savings pot. There are three path parameters
accountId for the user's account
potId for the ...
0
votes
1
answer
106
views
Authorization business logic on claims or on app database?
Context: I have an API (using DDD) with an entity lets call it "Content" that only can be update by certain users.
For example Content with Id = 1, can only be modified by User Id = 1, ...
0
votes
1
answer
353
views
POST and PATCH for a nested resource in REST API
One post can have many comments.
How can I design REST API urls for HTTP POST and HTTP PATCH for comments.
My idea is to have the following endpoints:
HTTP GET: /posts/{postId}/comments
HTTP GET (all ...
0
votes
4
answers
186
views
How to eliminate repetition in three subclasses: each defines an identical method that does almost the same thing, but with a different return type
TLDR:
I have three subclasses, each inherits from the same parent class, each defines an identical method that does almost the same thing, except that each of these methods has a different return type....
9
votes
3
answers
7k
views
How should source code unit tests affect semantic versioning?
I recently started using Semantic Versioning.
Due to conflicts with my previous versioning convention (which I created myself), I am very confused about versioning unit tests as part of the public API....
-2
votes
1
answer
157
views
Are there some best practices how to build a client library for an API?
I was tasked to create an API client library for our already existing API. I tried to research some ways how to approach this but couldn't find anything. Are there some best practices how to build ...
0
votes
1
answer
79
views
Alternative ways to transfer records from one environment to another
I'm working on an application which has a feature of syncing records between two environments. For example, a record A is created in environment A. After a user verifies it, the user can use the sync ...
-1
votes
1
answer
88
views
Is there any benefit/viability to sharing models across API versions that have differing schemas
I have been asked to get involved with a Team that is currently having delivery issues for various reasons. During my review I came across an acceptance criteria on a user story;
If you call v1 of ...
2
votes
3
answers
366
views
Does it make sense for an API with 1 daily job to do to be asynchronous?
This is a conceptual question about whether my specific use-case warrants the use of an asynchronous API.
Language: Python 3.11
Framework: FastAPI (ASGI)
I believe I am confused about what an ...
1
vote
1
answer
221
views
Reserving Unique, Sequential Group Numbers in ASP.NET Core with EF Core and GraphQL
I am developing an API backend using ASP.NET Core Minimal API (.NET 7) with Entity Framework Core, HotChocolate (for GraphQL), and a Microsoft SQL Server database. I've encountered a specific ...
1
vote
1
answer
124
views
Persisting data in a mobile app backed by a rest API back-end, advices [closed]
So I am working on this mobile application using MAUI, which is backed by a Rest API in ASP.NET Core.
I want to be able to use the app offline, and the user can create/edit some data. This data is ...
0
votes
1
answer
36
views
Is using an Azure Function to forward a message to my App Service the best idea for handling a Twilio Web Hook?
I have an Azure App Service running a .NET (Core) API for an inhouse application, which I'm integrating with Twilio to handle Whatsapp communication.
To handle the web hook responsible for receiving a ...
0
votes
0
answers
51
views
Package by feature for APIs that are exporting or / and importing data
We are generally following the package-by-feature approach, which is great.
However, one specific case is constantly causing confusion and inconsistencies, and I'd like to know your approaches in this ...
2
votes
0
answers
361
views
Managing environments in a FastAPI app using Docker
Bit of context: I'm an Economics major that somehow ended up developing an API that's becoming a whole software project, so please bear with me.
So, after I got asked to add logs I noticed I should ...
0
votes
2
answers
189
views
API - What are some good strategies to limit hitting database on query-based searches?
I'm building an API that allows people to search for books (just for simplicity). There is an endpoint that takes a query string and returns the top 10 matched results. For example:
/api/v1/book/find?...
0
votes
1
answer
48
views
What are standard ways to pass the event signal over fixed level only connection?
I need to pass exactly event (not a lasting state) over communication connection that can provide boolean or integer value, possible to set, clear and observe by both sides. It is OPC UA framework but ...
0
votes
1
answer
149
views
Which is better API design for POST endpoints?
I want to create an endpoint for posting different types of commands. I have the option to have one route /commands which can be used for every command type or one route for each command i.e. /...
0
votes
0
answers
76
views
Securely Handling Session Keys in Excel for API Authentication
I'm working on an Excel tool that needs to synchronize with a CRM via its API. The CRM's API authentication process involves logging in with a username and password, after which a session key is ...
0
votes
0
answers
20
views
Use of extra claims in a token for authorization checking purposes
Currently we are moving to an API driven architecture using SPAs and WebAPIs. We are also moving from SAML2 to OAuth 2.0 and if it is appropriate, OIDC.
We have a couple of APIs and one of the APIs ...
0
votes
1
answer
598
views
Is it okay to combine bff and rest api?
I'm building an application related to donation on streams.
And I have such models as "alert" and "alert-template".
"alert" is a set of different parameters to understand ...
0
votes
0
answers
65
views
How to provide user id to proxied services in an API gateway pattern?
I'm making code examples of how to start a modern microservices web architecture from scratch, and I only recently learned about API gateway pattern. So far, the authentication methods I used for ...
6
votes
3
answers
2k
views
Best design practice when one python method passes most of its arguments to another method
My code has 2 python methods defined, m1 and m2. m1 receives 6 arguments - p1,p2,p3...p6. It uses p1 in its own code, but passes p2-p6 to m2. Is there a recommended programming style here to prevent ...
-3
votes
1
answer
380
views
I do not like RESTful APIs anymore and dont understand why nobody agrees with me [closed]
Some years ago, every API I developed was a REST API and I did everything to follow the best practices to make them "RESTful".
But after some time, I have my doubts if RESTful APIs that ...
0
votes
2
answers
1k
views
Do we need APIs to just access databases?
At work, we have a Web application, which makes queries to databases, and I’m asked to determine if using Web APIs could be an added value.
Personally, I’m not convinced it is.
I know Web APIs are ...
-2
votes
2
answers
2k
views
API design. Make multiple PUT request or one single PUT request for updating multiple fields of the same database
I have three seperate fields and all three are unrelated to each other but part of the same collection (Tables for SQL folks).
Now, what I'm getting stuck at is, should I allow end-users to make one ...
2
votes
2
answers
203
views
Do RESTful endpoints elminate the need to SQL triggers?
Do RESTful endpoints eliminate the need to SQL triggers?
Triggers are supposed to execute after a certain event. Would moving to RESTful api endpoints conceptually eliminate the need for SQL triggers?
...
0
votes
1
answer
253
views
What is the responsibility of a typed HttpClient in .NET?
Say I have a simple layered .NET application, with three layers:
API
Adapters
Application
The application layer needs to use some typed http clients to communicate with external APIs. This means ...
3
votes
3
answers
643
views
What exactly is a REST API in reference to Docker?
AFAIK, APIs are a means by which two computers communicate with each other.
What exactly is REST API?
My confusion arises from this figure where a docker cli which is on the same host as the docker ...
1
vote
0
answers
95
views
Designing an API adapter with multiple authentication types
I'm building an HTTP API database adapter that has an authentication component. Users can authenticate using password, federated login such as OAUTH, and JWT.
My initial design is something like the ...
2
votes
3
answers
1k
views
Is it bad practice to create a resource in a GET request when the resource will be created later automatically?
At the moment I design a RESTful API for a resource that is normally created by a cron job from existing data.
Since the cron job runs only every 10 minutes it is possible that GET: /user/{id}/...
0
votes
2
answers
208
views
Do I use a model or controller in an existing MVC application for implementing an integration that makes API calls?
I have an existing application using Codeigniter Framework (MVC). I need to implement an integration in the software with the external cash register (e.g., making REST API calls). I need to either ...
2
votes
1
answer
1k
views
Clean architecture - how to manage use cases that depends on external apis
How to apply clean architecture concepts in a software that depends on External APIs.
Example:
A business that offers some kind of subscription to its users.
Its convinient to store some subscription ...
1
vote
1
answer
1k
views
Single api gateway or one for each microservice
We are going to have multiple microservices and decided to use api gateway. What we couldn't decide is if we should go for a single gateway for all of them or one for each. The reason why one for each ...
0
votes
0
answers
100
views
Translation Server-side vs. Client-side when having the same locales files
I'm currently working on a Turborepo project (monorepo architecture) and I have managed t share my locales files to both back-end and front-end parts.
This means I share the exact same keys across ...
0
votes
0
answers
245
views
Improve return type for CRUD GET list or details objects
When creating the crud GET methods to get a list of items, or the details, what should I return? The whole object properties for both cases? Or just the properties that are necessary? I'm asking this ...
0
votes
2
answers
312
views
Is this service considered "an API"? Could it benefit from being Restful?
I'm confused about the meaning of API, specially in the context of REST. I'm thinking of one example.
My company creates an application that runs on a server (the "backend"). (JavaScript in ...
0
votes
2
answers
356
views
How to keep OpenAPI specification up-to-date and compliant without using code generators?
In our company, there is no standard for how to document APIs. Missing API documentation slows down the development process.
Therefore, we want to introduce OpenAPI.
We want to use code generators to ...
3
votes
2
answers
255
views
Abstracting constrained strings in serializer. Good or bad practice?
I'm using FastAPI and in my schemas (that is, serializers) I have something like this:
from pydantic import StrictStr, BaseModel
class Str255(StrictStr):
max_length = 255
# my schemas:
class ...
0
votes
1
answer
203
views
How can I implement a lazy-loading cache for REST objects with custom role-based access?
I'm thinking through adding a lazy-loading cache to my API. Currently, REST objects are filtered out (scoped) based on the user's role, and additional constraints in the system. Users of the same role ...
0
votes
2
answers
229
views
How to best protect a public API from unwanted requests
I’ll try my best to explain, but for the closest context I could think of, imagine that I am building an analytics platform that allows paying users to sign up, place a tracking script on their ...
0
votes
2
answers
166
views
The best way of preventing unauthorised API use and reducing costs of declining API requests
To best explain my context, imagine that I’m creating an alternative piece of software to google analytics (since my personal project’s principle is similar). Each unique user creates an account and ...