Questions tagged [web-api]
Specific APIs that communicate over web protocols, such as ASP.net Web API, as well as APIs that are exposed to web pages for network communication or apps for device communication
390 questions
1
vote
1
answer
335
views
Which approach to specifying a database connection in a web API, is preferred?
Where I work, they have never implemented web APIs. At my previous job, which I left 11 years ago, I would write several web APIs to be used for applications, reports, etc. So when I came to this job ...
1
vote
1
answer
169
views
ASP.NET MVC and Web API Together vs. ASP.NET MVC with JSON-Returning Action Methods
In an ASP.NET MVC application with views that make AJAX calls for widgets like dropdowns and data grids, is it better to use Web API controllers or regular MVC action methods that return JSON?
The ...
4
votes
4
answers
849
views
Is it okay to deploy both front end and backend everytime if they are in a single repository
I have a project with .net core web api backend and angular as front end.
I have single repository for both the projects with front end and backend in their own separate folders.
I have written ...
0
votes
1
answer
524
views
Should you use nested routes within NestJS for a "RESTfull" API
Here is an Example API for managing companies, employees, and their children. My entity relationships are as follows:
company -1:n-> employees -1:n-> children
I’ve structured the API routes ...
1
vote
0
answers
112
views
How to model api error type with errorCode and parameters
I work on a spring kotlin backend which has an angular and a mobile frontend. We are currently working on error handling and we decided that the backend should return an error code, a general message (...
1
vote
5
answers
336
views
Purpose of async/await in web servers when stuck with legacy I/O
A couple days ago I asked about the Purpose of async/await in web servers, and got in-depth answers explaining how in fully asynchronous code, it frees up the CPU completely while also releasing the ...
0
votes
2
answers
176
views
Allow-Rendering-Prevent-Download Architecture
I am trying to devise a simple system that, with the use of tokens, allows a specific file to be rendered in the client's browser, yet prevents the user agent from being able to download the file. ...
0
votes
1
answer
140
views
Return response from controller or raise exception from service
I need some guidance on how to send error responses to client from WebAPI controller for an update operation. I need to check if data is changed and if it has duplicate data. I have service class that ...
1
vote
2
answers
280
views
Request validation on API proxy
I am creating an API proxy that acts as a bridge between our frontend application and an AWS opensearch server. This proxy has additional features such as retries and timeouts.
One of the features I'm ...
1
vote
1
answer
923
views
Is 10 KB a large amount of data to pass around each time a user makes an API call?
Each time a user of my APP / website interacts with the APP such that it makes an API call to the backend, the backend will make an API call to the mongoDB database to retrieve the document that holds ...
0
votes
0
answers
240
views
REST Api filtering, sorting and order
I've seen in several REST API guidelines recommendations to use filtering in form of, e.g.:
/products?filter=name eq 'Milk' or price lt 2.55
(example from: https://github.com/microsoft/api-guidelines/...
0
votes
2
answers
344
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 ...
2
votes
1
answer
1k
views
Aggregating responses from several services with reversed proxy (API gateway): where to place code?
We have a system with a few microservices and multiple clients (Web, mobile). Currently, only one microservice (let's call it "Master MS") exposes a public API, which is used by all clients. ...
2
votes
2
answers
3k
views
Improve performance for HTTP Request with huge body
I'm struggling to understand how to improve the performance for an HTTP Request that comes with a huge body.
Now, let me explain better what I mean with performance!
Imagine I have a DB with the table ...
0
votes
2
answers
59
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&...
6
votes
3
answers
3k
views
Difference between API and protocol?
What's the difference between an API and a protocol?
To use a specific example: Is Coinbase's choice to refer to its WebSocket client specification as an "API" appropriate? It seems that ...
0
votes
1
answer
216
views
Is there a best practice for storing multiple pages of JSON responses from an API?
Scenario:
An API that responds to a request with multiple JSON objects contained in an array.
The responses are paginated such that each page returns an array of JSON objects.
I deserialize the JSON ...
-1
votes
1
answer
63
views
Dashboard based on 3rd party application - duplicate data to local db or should I view the third party as my database?
I am currently building a web based solution based on an application used in my organization. The application have an integration (SOAP-based API).
To keep things simple, I want to build a analytics ...
1
vote
1
answer
535
views
Testing API with Auth0-enabled user authentication and authorization
I have a REST API and a SPA application, with Auth0 server issuing access tokens and enabling end users to login with their social identity provider. The API expects to receive a JWT access token with ...
-2
votes
1
answer
487
views
How often should I request a token when communicating with a third-party API?
I have an ASP.net web API. I would like to call another API that has an authentication token inside my API.
The code flow is as follows:
My API is called → Get authentication token from 3rd party API →...
1
vote
3
answers
1k
views
Should I unit test functions internally used by API I expose?
I'm writing a CRUD app in Python that exposes web API. At first I wrote functions for communicating with DB and wrote tests for these functions.
def crud():
# do something with db
def test_crud():
...
0
votes
1
answer
215
views
Best mapping practices in an enterprise application
This question might seem like a trivial question. But here it goes.
Currently, I'm working with this .NET Core application, an N-tier application consisting of a Vue frontend, business logic layer, ...
0
votes
0
answers
180
views
What would be the best way to queue asynchronous calls received simultaneously by a web service cluster?
I have an API where every time is called there are multiple calls to multiple webservices in the background, sometimes it takes up to 20 seconds to process the request calling up to 10 different web ...
1
vote
3
answers
708
views
Is the "archetype controller" really complies with REST architectural style
I've read the Fielding's thesis that defines the REST architectural style and noticed that the defined style appears to significantly conflicts with the so called "archetype controller", ...
0
votes
0
answers
1k
views
add web api endpoint, which return html from view
I have ASP.NET 5 Web Api and need to do the following task:
Add endpoint, which get cshtml page and return generated html, so it should do the same what is does razor view engine.
What is better way ...