Questions tagged [api]
An application programming interface (API) is the specification for which software is meant to be used by other software.
1,283
questions
-2
votes
1
answer
137
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 ...
1
vote
2
answers
275
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 ...
-1
votes
0
answers
79
views
Proper abstraction for third-party API?
I'm writing a library in C# that is meant to abstract calls from a third-party API, such that it can accept inputs from multiple potential applications. Currently, I have three broad classes:
Base ...
0
votes
0
answers
40
views
how to design shared settings in a multi user application
I am looking for a software design to solve the requirement that is the title of this question.
I want to keep this deliberatly open, i.e.even tho we're implementing this in C++ I am open for any ...
-2
votes
2
answers
66
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 ...
-1
votes
0
answers
32
views
REST API: Separation of customer and management facing side
I plan to develop a application which consists of 4 different parts.
Customer REST-API
Customer PWA (Communicates with the Customer REST-API)
Management PWA
Management REST-API (Communicates with the ...
2
votes
2
answers
146
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
91
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
571
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
56
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
210
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
31
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 ...
0
votes
1
answer
132
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 ...
0
votes
1
answer
115
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
49
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
68
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
292
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
185
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
240
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
102
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
185
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
153
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 ...
1
vote
3
answers
236
views
Filter using routes in REST API
I am working on making changes to an existing Web API that exposes information about orders for specific customers.
As a developer, I am used to seeing "more or less" RESTful APIs, and I ...
0
votes
1
answer
127
views
Middleware responsibilities and usage: checking preconditions for business logic
I am developing an API backend in NestJS, now for some specific routes (or controllers) I am loading in a configuration from the database to handle an incoming request. This fetching of the ...
2
votes
7
answers
395
views
Is there a term that describes the property of being synchronous vs asynchronous?
Is there a term that describes the property of being synchronous vs asynchronous?
The term that most naturally comes to mind is "synchronicity", however I only see this term being use in ...
0
votes
3
answers
247
views
Using GitHub repository as API
I have a set of complex data, which I use on various subdomains of my project. Data are static most of the time, it changes few times per year.
Currently, it's hardcoded in every project which needs ...
-1
votes
1
answer
383
views
Why do we need middleware in FASTapi?
From official documentation:
A "middleware" is a function that works with every request before it is processed by any specific path operation. And also with every response before returning ...
-1
votes
1
answer
38
views
What is the convention for deciding which resource to place an endpoint under? [closed]
I have an endpoint that teachers can use to invite students to a virtual classroom by providing their emails in a list format. Let's call it POST invite-students. I have these four resources:
api/v1/...
0
votes
1
answer
96
views
Return type abstraction of a service layer that calls an API
I'm trying to find the best solution to abstract the return type of the service layer.
I have a controller that calls a service to create a user. The service calls a REST API and receives an HTTP ...
0
votes
0
answers
69
views
What HTTP status code to return to differenciate resource not found from missing or deleted resource? [duplicate]
We would like to differentiate (by HTTP status codes) between correct request but the requested resource is missing or deleted and resource not found because of invalid request (URI).
For example:
/...
0
votes
0
answers
65
views
API contract design for field attribution based schema
I am currently working on a problem which involves defining the API contract (or DTO/Schema). Note that this will be private API, and non public.
The following image shows a possible form of the ...
0
votes
2
answers
50
views
Specifications to build a API context data
I was developing a new API, and some doubts appears about context of payload data. Example:
{
"transaction_id": 123,
"transaction_date": "2022-12-25",
"user_id&...
0
votes
1
answer
473
views
Can I use a session cookie for API authentication?
I want to build a web application with a Single Page Application as the front end and an API as the back end. The front-end SPA will read and write data to the API.
The SPA and the API will be hosted ...
0
votes
1
answer
93
views
API for a statefull AI server
I'm designing a web application for image analysis using AI. My API for CRUD operations is written in Django. Now I want to add the AI functionality which loads the model once on the startup, receives ...
1
vote
1
answer
88
views
Modeling properties of related entities
I have the following entity relationship.
A {state: ON | OFF} => B {state: ON | OFF} => C {state: ON | OFF}
So, in this case, B is a child of A, and C is a child of B. Moreover, they all share ...
2
votes
2
answers
1k
views
What's the proper response when I try to update an existing entity but with not found parent ID
I have an update API (PUT/PATCH) entity/{id} to update a certain entity in my DB. Let's say:
entity {
id: number, // Primary key, unique, not null
content: text,
parentId: number // Foreign key, ...
-1
votes
4
answers
1k
views
RESTful Batch Delete
When batch deleting a resource. e.g. deleting all Orders that belong to Customer 99:
DELETE /customer/99/order
If there are defined business rules1 that prevent Orders that meet specific criteria ...
0
votes
3
answers
96
views
Should security and data validation be implemented within database or application?
I am building a simple web app where one set of users have varying admin privileges who can write to database and the other set can only view data.
I am used to securing APIs with JWT or session ...
0
votes
0
answers
20
views
Django URL pattern style advice
(!) This is a crosspost, my post did not fit into Code Review.
I am building an e-commerce website and I want to serve my products through an API.
Each Product has a Product ID and some variants (e.g ...
0
votes
1
answer
685
views
Is it bad practice to require nested JSON data, on my API endpoints?
I've made an endpoint for creating events: POST /events/new
The request should have JSON data on the body. This is the JSON structure that is required for creating a new event:
{
"label":...
0
votes
0
answers
36
views
Clarifications on application/server architecture in manufacturing context
Context : I am currently task with building a software to support operators in a manufacturing plant. Due to the nature of the plant, the computers all have fairly weak processing power (given that ...
0
votes
3
answers
283
views
What's stopping an app from using another platform's storage, for free?
Let me clarify on a bit of an abstract question.
I'm about to develop an app, through which users can capture and store images. Commercially, the main cost here that springs to mind is storage cost.
...
0
votes
0
answers
114
views
How would I model my NoSQL database for a conversational bot
I'm currently developing a chatbot that will be used for booking trips. The particular party I'm interested in for now is the rider. I'm using AWS's DynamoDB, because it seemed to be the most flexible ...
1
vote
0
answers
30
views
Handling events internally in server
I'm trying to make sense of how to handle events in my server in a neat way.
I'm creating a Whatsapp chatbot that receives messages via webhooks at a certain endpoint on my server. It doesn't seem ...
1
vote
1
answer
122
views
Django: Is there a reason to separate api calls into their own url endpoints?
I started a project awhile back and have made a lot of progress since then. In the beginning I didn't think much about restful architecture and how I'd serve data to the frontend. Now, however, it ...
2
votes
2
answers
1k
views
What log level should be used for an expected but (potentially) bad occurrence?
In my team we are currently building an API gateway, where the client can authenticate themselves with an API key. Naturally the authentication may also fail, which produces a message in the log.
...
2
votes
1
answer
263
views
API Gateway- how internal services should communicate with external system
we have a microservice architecture.
There is an API Gateway that acts as entry point for a External System (SAP)
It is clear that SAP should connect with our system using the API Gateway.
But, in ...
1
vote
1
answer
568
views
Additional questions for an old topic: "How to specify many ids and their variable name in a REST API request?" [duplicate]
Sorry, I would have left a comment on the other question, but I don't have enough reputation.
I have the same problem as in this question:
How to specify many ids and their variable name in a REST API ...
1
vote
1
answer
205
views
Best practise for designing REST API endpoint that accepts a nested resource POST
What's the recommended design for an endpoint that accepts a nested resource as the following:
POST /account
{
"name": "Project John Doe",
"description": "...
0
votes
7
answers
784
views
Within the same computer, what is the difference between API and IPC?
So, an Application Programming Interface is a way for two or more computer programs to communicate with each other.
An application programming interface (API) is a way for two or more
computer ...