Questions tagged [api]

An application programming interface (API) is the specification for which software is meant to be used by other software.

Filter by
Sorted by
Tagged with
1
vote
4answers
242 views

REST API include permissions into resource

We currently have REST API, where you have a set of different resources, like: GET /cats GET /cats/{catId} GET /dogs Clients decide whether they can perform an action based on resource permissions. ...
0
votes
1answer
68 views

Should List(Get) and Search be the same endpoint API (method)?

Here are two endpoints (or methods): ListResources(user_id) - Fetch the resources based on the given user id. SearchResources(query_options) - Fetch the resources with specified conditions. The ...
-3
votes
1answer
248 views

How do I overcome the limit of 4000 results returned from the REST API?

I have an application which records the company man hours of employees and other related details. Because it gets updated everyday or when a new employee is added, it tends to lead to a very large ...
2
votes
4answers
299 views

Alternatives to polling an API

Assume we have a desktop application (probably WinForms) that acts as a client to some API for an app with a messaging function. This API has endpoints that return a JSON of messages, and who sent ...
1
vote
1answer
112 views

Terminology - Changing the behaviour of a function but not it's name [closed]

Consider this situation: there is a method getFoo(). It now becomes appearent that the method as-is is not useful or even encourages faulty code to be written upon it. A breaking change (e.g. ...
2
votes
2answers
124 views

How to combine session-based authentication and stateless REST API

What is the proper way of combining session-based authentication with stateless, token-based authentication for a REST API? Use case: User logs-in in the standard, traditional, session-based way. ...
-2
votes
1answer
121 views

Where to conform the API? [closed]

I have a software accepting a HTTP request like this (and I'm happy with that): /products?page=2 /products?category=123&page=1 /product?id=123 /cart?show=table Now there is a consumer third-...
1
vote
2answers
519 views

Direct Service Calls vs API Gateway For Microservice Communication

I've such microservice architecture as below. I want execution service to get some information from storage and assignment services. I want to use MVC App like an API Gateway and handle all ...
1
vote
1answer
138 views

How should REST resources relate to the server database schema?

I am trying to understand whether resources in a RESTFUL API should directly represent the underlying database or not. In particular, a problem that I have is that I usually use highly normalized ...
2
votes
1answer
182 views

How to avoid duplicated logic on frontend SPA and backend API

Every time I'm working on an SPA with an API backend I always find myself wondering the best way to do this. The current example I'm running into is as follows: When a User has their account created ...
-4
votes
3answers
78 views

REST API design: Best practice for POST to create an object to a list

I have an API that return list of Employee. This API will have an offset and limit for pagination purpose. On the frontend, I use Single-Page Framework (Vue/Angular/React..). This SPA have a Employee ...
0
votes
2answers
146 views

Http Status Code When Downstream Validation Fails

I have an API that charges for an order. It accepts the orderId and the amount as inputs. Then it makes a '/charge' call to the downstream, which returns a 202. Immediately after this call, it calls a ...
3
votes
4answers
267 views

Should a transformation function take a nullable and return a nullable or should the caller handle nullability

Often I need to transform a type to another, such as a networking model to a data model, or a data model to a binary representation. Should these transformation functions take an Optional/nullable ...
2
votes
6answers
517 views

Is building REST API compatible with Agile approach?

I believe I understand what REST is and what Agile is. Our company has some APIs that we maintained, usually we only needed to tweak some requests or responses to fit new requirements. Recently, we ...
0
votes
1answer
53 views

How to design a repository when datasource differs based on DML/READ operations?

We are starting our new application in which we using MS SQL DB for all our insert/update/delete/select ie. both SELECT and DML operations. But, soon we will have two different sources. SQL Server ...
2
votes
4answers
2k views

Is creating ViewModels in Web API a bad practice?

So, somebody at work who is twice as experienced than I am, told us that we must not create ViewModel classes within Web API. (We are using Angular for UI) In his opinion ViewModel is ASP.NET MVC ...
2
votes
2answers
100 views

Separating namespaces from files in Python

I'm writing a Python library in which various objects are represented as Python classes. However, the user is not supposed to create instances of those classes directly. Instead, there are a set of ...
-4
votes
1answer
29 views

extending an MVC site to support a new controller, via adding a v2 area <- good idea? need help with routing

I want to extend our api to a (better) v2 version. I came up with the plan of adding a "v2" area and under that, cloning each controller into it. (basically v1 sometimes returns json, sometimes text, ...
2
votes
5answers
428 views

Is it acceptable to accept multiple results in a unit test?

I've noticed this while implementing a Rest-API today. We first define interfaces for each API method and the api contract for one endpoint allows (amongst others) two status codes: 200 and 204. Both ...
0
votes
0answers
52 views

Ist good practice adding Converter Between api and client

I just want to curious about adding a converter is a good practice or not. I have multiple API and I always convert API return fields to my client fields. Like=> function ConvertFromAPI(apidata){ ...
2
votes
4answers
1k views

Cron Job Microservice

I'm implementing an application that's made of bunch of microservices. Each of them is fairly simple, focusing on its own task. Let's call two of them Service A and Service B. They are both ...
0
votes
1answer
132 views

API that isn’t web service

It’s a bit hard for me to wrap my head around an API that isn’t a web service. I am sure they exist, because even as I use my phone, I’m sure the developers didn’t need to specify how to use the ...
0
votes
0answers
17 views

Using both jwt tokens & api lifetime tokes in Laravel app

Previously I had some experience using JWT tokens when making SPA. The workflow is: User enters email & password, gets JWT token, the token is stored in local storage and is passed in each ...
2
votes
4answers
1k views

Is there a way to store a secret API key to my backend, which the frontend can safely ask for?

I'm using the google maps API, which has a secret key that I need to use on the client side. I was thinking of some alternatives to store it safely. One of them is storing it in my flask database. ...
-2
votes
1answer
41 views

Endpoint returning only new and updated records

let me state some items. I have this endpoint that returns a list of objects, and I would like to return only the changed ones. I have an App calling this endpoint that caches this list, and today it ...
3
votes
3answers
519 views

REST API: what should PUT do with complex objects?

Let's suppose I have the following objects in my domain: class Warehouse { int Id; string Address; Item[] Inventory; } class Item { int Id; string Name; int Price; int ...
0
votes
1answer
66 views

Updating last resource access time when clients perform a GET

We have many clients which, upon start up, request a specific resource on the server using an HTTP API (not RESTful). This resource is - currently, identical for all clients. Naturally, since the ...
1
vote
1answer
81 views

Who maintains an API Gateway?

API Gateways are great. They can produce a nice unified view of a sea of micro-services living behind them. However, on large scale projects, what patterns can be adapted to allow a single API ...
2
votes
0answers
26 views

Architecting OAuth2 Flow With an API and Static JS Client

I'm building a very security conscious application. (All applications should be security conscious, but this one may contain a lot of red data). Assuming that I will use a Vue/React JavaScript Single ...
0
votes
1answer
78 views

How to manage breaking updates in an API & database

So I have been working on my mobile app for a while and it is live and in production. Because we released the app prematurely and are continuously improving current features and making them more ...
37
votes
8answers
9k views

How can I discourage sharing internal API keys within a company?

We’re working on a new service – this service will potentially be called directly from applications on user devices. These applications will be developed and supported by multiple development teams ...
4
votes
2answers
162 views

client / server division of responsibility

It makes sense to give the server applications as much responsibility as possible as to avoid having to rewrite logic across different types of clients. In my case I am developing a data structure ...
1
vote
2answers
323 views

Why do large organizations struggle to build standard APIs?

I work for a company with 580+ cloud APIs (with every API implementing different functionality, but with a lot of overlap) and even more micro services. There have been many attempts integrate all ...
1
vote
2answers
1k views

REST API Input Validation Strategy

I am implementing a REST API and need to validate the JSON API inputs for the CREATE and UPDATE endpoints. The goal is to send a 400 error prior to doing any processing if the inputs are not valid. ...
1
vote
2answers
81 views

REST: How to reference existing resources in a HTTP POST request body?

This question relates to a somewhat more specific case than the one discussed in How can I create a RESTful calculator? It should be assumed that the values to be calculated are not simple integers, ...
0
votes
1answer
392 views

Keep data in sync with 3rd party api

I'm currently facing a difficult problem regarding re-archituring a legacy webshop, i would really appreciate some insight. The system depends on a 3rd party API for it's product/variant data the ...
0
votes
1answer
58 views

Should two different set of login APIs follwing REST have write access to the same DB?

Like for example, /api_1/login and /api_2/login writing in the same table of the same database.
1
vote
1answer
25 views

Represent nested resources that has two different type (entites) owners in REST APIs?

Suppose I have a entity called Appointment. This entity represents an medical appointment between one Doctor and one Patient. To create a new Appointment, I send somethind like: POST /appointments {...
6
votes
6answers
589 views

Should error codes in JSON be integers or strings?

I'm designing a backend webservice, and when an error occurs I'm returning it as a JSON to the frontend. This JSON contains an error code, which the frontend maps to an localized string and shows that ...
1
vote
4answers
944 views

How to do versioning for stored procedure?

Is there any way to create versioning for stored procedures? I have created an API which fetches data from a database using stored procedures. This API is being consumed from a mobile app. I released ...
0
votes
1answer
244 views

Data replication with microservices using a messaging broker

I have a microservice based application like so: User.Microservice - stores , user information. Product.Microservice - stores products that user created. Order.Microservices - stores product orders ...
1
vote
2answers
128 views

What's the most common way to handle API integration?

I work with some not-monolithic applications, meaning that at some level, it depends on other applications to do the work. At the moment, each application on our stack, when there is an API change, ...
0
votes
4answers
2k views

Is it worth logging HTTP requests when they enter an API server?

I'm designing an API and have reached the topic of logging. I'm going to store my logs in Elasticsearch. I'm certainly going to do some logging at the time the HTTP response is sent back to the ...
2
votes
1answer
197 views

Which setup is more REST abiding?

I want to create an endpoint for "logging out". Logging out in my case is basically removing an access token from the database. Therefore DELETE verb makes sense here, something like this: DELETE URL/...
0
votes
1answer
61 views

Designing Rest API endpoint for viewing bearer access token

We have several endpoints which were authenticated using a bearer access-token. There was another endpoint which will renew/generate a new bearer access-token on passing valid secret_id and client_id. ...
4
votes
4answers
3k views

Why must API keys be kept private?

I have worked with public API's in only one small project, but I recently learned that if one were to distribute a project with API keys inside this is a security risk. So I have two questions: What ...
1
vote
1answer
72 views

Api limit access to subscribers only

I have a vanilla php api(on a vds) and I want to make data coming from that api available to a few clients that are using a python app that's also written by me. That python app is running on my ...
-2
votes
2answers
147 views

Confused about how APIs are called

I'm new to APIs. Conceptually, I understand what an API is, but I get confused when it comes to the some of the technical details. All of the tutorials I've read talk about URLs and endpoints, and ...
2
votes
1answer
74 views

How do I create an HTTP PUT request that modifies the resource in many ways

I have a NodeJs backend that interacts with MySQL database. Let us assume that I have a schema similar to this: Book id name Author id book_id name So, I have two tables named Book and ...
0
votes
1answer
237 views

What is a good Object-Oriented design for geometry objects when building libraries dealing with geometry operations?

I am trying to design an object-oriented library to handle geometric calculations. However, I am trying to exaggerate on being "tightly" object-oriented and applying relevant "best practices". I know ...

1 2
3
4 5
22