Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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

0
votes
0answers
23 views

Is this a secure way for logging users to a web and api?

I am splitting a monolith Laravel application which has both api and web routes, to 2 separate applications. The browser is making an AJAX call to the new API service (all routes /api are routed to ...
0
votes
1answer
30 views

REST API - Standard for also creating required parent entities?

We're creating a new API to add new Jobs into a legacy system. The question deals with how to handle creating a Job's required parent entities when you don't know the IDs of those parent entities to ...
0
votes
2answers
92 views

How to handle dependencies in Web APIs

I'm struggling with a decision about how to design a web-API where I create new "things". We roughly follow the API guidelines of Zalando, which do provide a nice starting point for web-APIs (https://...
1
vote
1answer
57 views

Should all my asp.net MVC controllers use Web APIs?

The thing that I don't understand is the prioritization between MVC Controllers and Web APIs. Consider I want to make a website. I can either program to APIs and for the presentational layer, force ...
-3
votes
1answer
40 views

Design Restful API Get manipulated data from resource [closed]

I am new to rest, I have an entity called availableJobPositions. I want to get most Interesting job by sending a person skills. which url is good in restful: api/positions/skill/most-intersting?...
0
votes
2answers
90 views

Should I put the messages for business logic validations in API?

I have a REST API written using ASP.NET Core Web API. There are a few business logic based messages I want to send to the clients from the API. I am in a dilemma on which of the following ways I can ...
1
vote
1answer
153 views

Web API Bad Request design

My organization is developing a Web API server. We will also develop the only clients authorized to access the API. We will follow the usual technique of returning Bad Request (400) errors for data ...
0
votes
1answer
124 views

What is the best practice for sending a large array of strings to an API

I'm building a simple app that is a client web application and an API behind it. I'm combining two third-party APIs, one needs to be called from my client application (for ease of authentication) and ...
-1
votes
2answers
49 views

How to handle list arguments with invalid and valid elements

When you have an endpoint that can take a set of valid parameters, how do you do validation on a non-empty set of elements? Say you have a request /api/endpoint?my_list=1,2,3 where 1, 2, 3 are the ...
1
vote
2answers
100 views

How to consume nested objects in API resource

I am building my first web application, it links to the serverside through RESTfull Web API (Angular on client side, ASP.Net Core and EF Core on serverside, Automapper to map API Resources to/from ...
0
votes
1answer
48 views

Designing anonymous registration website

I am developing a website where customers can register products they bought in order to receive a benefit in the form of e.g. a cashback, a discount or promotional goods. In the future, we also plan ...
0
votes
2answers
134 views

How to describe an API-like request that is browser-to-browser?

I'm building a web application that has a feature which allows visitors to directly access resources using URL patterns, for example: www.site.com/client/[clientID]/orders www.site.com/client/[...
-1
votes
2answers
115 views

Why should I use REST API?

I somehow get the point of REST API, like for example you want to get the list of customers to the database server, you have to request a GET method and the server will throw a response with a ...
1
vote
1answer
132 views

Best Practice: Third party API on client (Desktop) or Server

I have a small Desktop application (Windows+Mac) that uses third-party API calls (RESTful) to collect some data and present results to users. At this moment, the API calls (open and free APIs) are ...
-1
votes
1answer
120 views

how to expose complex actions in RESTApi using http verbs

consider the following REST resource Account { number:"number-000", name: "name", customer : {}, type : {}, status : "status", balance : 0, rating : 0.0 } Now say we have the ...
1
vote
1answer
26 views

Logging web API POST requests for retry to outside service

My web API talks to an outside service running elsewhere, based on the web API requests (mostly POST). There is a message queue (RabbitMQ) that sits in between them, for request/response from either ...
0
votes
1answer
40 views

Best way to make insert data in logs web API. REST or WebSockets

I want to make a centralized log web API, so it will have a large amount of data per seconds. the logs will comming from others WEB API I was thinking if i make the REST API, all of the POST made ...
1
vote
1answer
73 views

Data is in database or get from API, where should API request code goes?

For me, the data I want to retrieve may be in database for which I can use properties of model and also relationships, but if the record is not a property and no relationship exists for that ...
1
vote
1answer
63 views

Recommended manner of installation for an open source web application and api?

I'm currently working on my own open source project. There are two parts to it at the moment, a .NET core web API and an Angular client side app. I would like to get your views on installation/setup ...
2
votes
1answer
59 views

Keep Hitting 3rd party API or Store Commonly Queried Data In DB?

Colleague and I have begun a long (and hopefully fruitful) project. I've been building and have come to my first crux, and now I ask the experts of the Stack Exchange for their guidance. I'll keep ...
0
votes
1answer
63 views

Use same API for both website and other clients or not?

Lets say I am building some large application ( multi-page app ) using Laravel. And laravel will allow me to make an API and a website on the same application. Since the website and the API ...
-2
votes
1answer
72 views

Is it a good idea to ask for requestId in each API call?

I see some services which takes a requestId from client as the mandatory attribute while some services doesn't. I feel it is a good idea to have a request Id from the clients because it helps in ...
0
votes
1answer
37 views

Retrieving JSON and image representation of a resource

I am developing a RESTful API designed primarily (but not exclusively) for consumption by a web application. For the purposes of this question, the API is a set of GET endpoints. The main endpoint is /...
0
votes
0answers
108 views

Separating models in a Backend-For-Frontend (BFF) API

At the moment I have a frontend client calling several backend REST APIs. For example a call may be to get information about a certain vehicle. Then the client will call REST API A to get some ...
0
votes
1answer
201 views

The Frontend-Backend Vs. Backend-Backend

I've seen this pattern pop up in a couple of different teams. They have a server with a REST API and a frontend web project. What commonly happens is the frontend developer finds their requests are ...
0
votes
1answer
142 views

Check if user is logged in when using JWT

I have an app that uses JWT tokens for user authorization. Now, I need to be capable of deactivating users (users won't be allowed to use the system but still exist in the database), but as a ...
1
vote
1answer
87 views

Web API POST: single item vs collection

No code to show (and not really a code issue) but I have an iot-ish application running that is using PI Zeroes as clients and they are slow. A single POST takes about 10 seconds round trip, the delay ...
-2
votes
1answer
140 views

How to implement HTTP PUT correctly

I'm really looking for one good example how to PUT operations should be implemented correctly. What I understood until now: The operation must be idempotent When the resource doesn't exists it will ...
91
votes
15answers
16k views

Should we design our code from the beginning to enable unit testing?

There's a debate going on in our team at the moment as to whether modifying code design to allow unit testing is a code smell, or to what extent it can be done without being a code smell. This has ...
0
votes
1answer
82 views

What is the optimal pattern to ensure a priority API gets cycles over its related (non-priority) API?

I have two synchronous web APIs that perform the same work but one needs to be prioritized over the other (the former is called from a client, whereas the latter is a caching optimization for before a ...
1
vote
1answer
149 views

Breaking 3-tier architecture into multi-tier architecture

Recently I have been working on a rather large system with Vue.js for a single page app (SPA) and an API for the backend. The customer is concerned with the security, performance and maintainability. ...
0
votes
2answers
90 views

Unit testing about API endpoints and parameters

Consider a simple web application, I'll use a Python(ish) example, but i think the question is relevant for other languages as well. The user is trying to fetch a page, and in order to render that ...
1
vote
1answer
86 views

Is Web API suitable as services for IoT?

The issue I care about here is high throughput, there are a lot of sensors (monitoring devices) which send data to the server at high frequency. It looks really like that we have to use UDP protocol ...
0
votes
1answer
89 views

Is It good practice on API design to use different object model for getting object and creating

While mostly every company got it's standard on APIs, the question just came out after that one of my colleagues stated we must use different object models for creating and getting objects from API. ...
3
votes
1answer
670 views

C# .Net Core API design - interfaces vs DTOs

I'm designing a relatively simple web application using .net core. I've mostly done desktop development in my career so far, so I'm a bit new to the nuances between desktop and web development. In ...
2
votes
3answers
101 views

Permissive vs. Strict API Message validation

We had a interesting debate today over what our REST API should default to doing when validating a request body where unexpected fields are present. I think we ended the conversation in a good place, ...
0
votes
0answers
31 views

WebAPI Versioning practice - Common version to all controllers

I am using Microsoft.AspNet.WebApi.Versioning for versioning my WebAPI project. I already used version through the header with CustomControllerSelector class. After learning this package, I am ...
1
vote
1answer
81 views

Am I making API creation difficult when it comes to authentication?

I know the sites are not geared for recommendations so I am hoping to pose this question in a way that doesn't ask for recommendations. Questions comments are welcome. I am just getting involved in ...
0
votes
0answers
16 views

Keep sync Authentication Server user profile with App Server best practices

I have two servers first one is Authentication Server that handles refresh token, AccessToken and external login. On external login, I create user and store profile information like first name and ...
2
votes
6answers
227 views

Difference between REST & HTTP REST implementations

REST principles are described here: https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm#sec_5_2 https://en.wikipedia.org/wiki/Representational_state_transfer#...
3
votes
2answers
74 views

Approach for storing lots of data of unknown type in database

I have an web app to which external applications can be connected to send their data. This is for telemetry purposes. The web app is not controlling what kind of telemetry data is sent to it - it can ...
-1
votes
1answer
89 views

Is it good idea to set custom-defined getter and setter in c#?

I tried this way to define custom defined property but I wonder how to handle if any of the dependent properties have null value. public class ObtainedMarksDetail { private decimal? ...
-3
votes
1answer
204 views

When designing a web application with Vue.js and ASP.NET Core, is ASP.NET solely for the API?

When creating a web application from scratch with ASP.NET MVC Core (using Visual Studio 2017) and using Vue.js, is the MVC Core part of the application solely for the API? What other function would ...
1
vote
1answer
109 views

How to remove code duplication in Web API versioning

I'm working with ASP.NET core web API project, where I have 8 controllers, multiple DTOs being used for request and response and mappers to map models(also used in the web app) with DTOs. Recently, ...
2
votes
1answer
272 views

Calling executables from an ASP.NET WebAPI

I have an Angular application with a table, and I'm considering having the console application take the name of C# programs that the user can run. I was thinking of passing the name or code of the ...
-1
votes
1answer
78 views

Any solution for scheduling a “high volume traffic” mode on API?

I have been wondering if there is any way to design and develop a mechanism for a REST API for scheduling some sort of "high volume" traffic so it does not conflict with normal rate-limiting. This ...
2
votes
4answers
301 views

C# class naming convention for a single item in the item list [closed]

In my C# project, I have a domain class named 'User'. this class will contain user's id, firstname, last name, DoB, home address, phone, etc. And we also have a typical REST web api (i.e. api/users) ...
0
votes
1answer
296 views

Mediator pattern across web API

What are your thoughts on mediator pattern being used from a client and across a web api?, this means: Command definitions are shared between the client and api. Web api exposes only one ...
0
votes
1answer
86 views

Best route naming convention when a RESTful GET needs to be a POST

I have a REST API that has been built on top (in front of) a legacy system, to allow 3rd parties of various platforms to interact with the system. Most of the time, I can define a resource and create ...
2
votes
1answer
128 views

Best practice for REST result payload when field may have single or multiple values

I Have a REST API endpoint where the caller can supply some optional filters for the results. GET api/inventory For example, an object member of a GET request may look like the following { "...