Questions tagged [api-design]

Application Programming Interface (API) Design discusses best practises for creating libraries intended for general purpose or public use.

Filter by
Sorted by
Tagged with
0
votes
1answer
35 views

One API used by multiple clients with small variation in the flow

I am working on refactoring codebase for a JAVA API thats used by multiple clients. Though the api provides the same overall functionality for all clients, actual flow changes a little bit between ...
0
votes
1answer
45 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.
5
votes
3answers
105 views

Domain-Driven Design: Cross-Domain Search

I have two systems (for sake of example, and orders and an account domain). Their interfaces consist of an api per system (an orders api and an account api). I have a UI that is sitting on top of ...
-3
votes
1answer
34 views

An entity belongs to another entity. Should a REST API provide just the ID of its parent, or its endpoint?

Say a dictionary belongs to a language. For the endpoint dictionary/{id}, which is preferable out of: {..., 'language_id': {id}, ...} and: {..., 'language': '/language/{id}', ...} ?
-4
votes
0answers
22 views

Web app architecture for pulling in, manipulating and emitting JSON [closed]

I need to build a small web app that will pull in JSON files from external sources (multiple JSON objects from multiple sources), combine and correlate them and then publish a new set of JSON APIs. ...
2
votes
1answer
143 views

C++ How to build a common interface with the possibility to call functions specific to only one class

I am building a common interface for several different backends that are shared libs loaded at runtime dependend on the used platform. It looks basically like the code below. My problem is, that while ...
-1
votes
0answers
19 views

Modelling a REST API for a form base input system [closed]

I'm working on a backend for a form based input application. Forms has templates, each form instance is based on a template. So i have come up with following resource endpoints /templates /forms ...
0
votes
1answer
41 views

API design refrence , Empty list response (REST, SOAP, …) type compatibility

Not sure where to go for an authoritive/text book answer for this question. Suppose a service returns a list of something e.g. Cutsomer, Employee, Fruits,.. what ever. what should be retruned when ...
1
vote
1answer
62 views

Distributing library which internally using COM library

I would like to create a dll library that will be loading in runtime. The library'll be using internally COM objects with MTA flag. The library will be created in main thread. So I have question: ...
-1
votes
0answers
22 views

How do I reference a library fragment from a main raml file?

I have a main raml file, and I have a library fragment file. The fragment file contains all of my data types. I want to reference this fragment from the main file, but I am getting an "Unresolved ...
0
votes
1answer
47 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. ...
0
votes
2answers
84 views

How do I effectively build a Product on my on my public API?

I want to develop a new product on top of an existing public API. This will require functionality to be added to that API. How do I develop and API for both public use (by other organisations) and ...
0
votes
0answers
37 views

How do I assign methods if I have 100 endpoints in a RAML spec?

I'm trying to build a RAML API specification for the first time. The API will need to give users access to 100 resources (endpoints), so I'm not sure how to assign methods to them. I assume there has ...
1
vote
0answers
18 views

Should custom Django Admin be separate from client endpoints?

I am currently in the process of creating a Django REST framework project for a client server web app. I would like to ask the following: Should I write a custom admin if I want my app to be ...
1
vote
1answer
38 views

How to handle or design review system with pagination?

In typical online review system if any user give review on specific post or others thing, then when that user view that post his review show first. The perfect example of this is Google Play Store. If ...
-2
votes
2answers
136 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 ...
1
vote
1answer
48 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 ...
1
vote
1answer
54 views

Designing an Entity Component System for interfacing with a scripting language

I am currently building an Entity Component System (ECS) in cython in order to speed up operating on large numbers of game objects in python. In the process of building this system, I ran into the ...
0
votes
0answers
42 views

How do you expose the field that caused the error?

Context: field errors Given an input in the form: { "list": [ { "username": null }, { "username": "test" }, { "username": "" } ] } Some APIs expose errors in the ...
-1
votes
1answer
18 views

Adding resources to subresource REST API

I'm trying to build an web API that closely represents a library of books. I currently have the following routes. GET /api/books GET /api/books/:bookID GET /api/libraries POST /api/libraries This ...
1
vote
0answers
31 views

Assigning default filtering values for complex API request model before passing it to business domain?

I am writing an API (web-service) for my customers and there is an endpoint which allows to search for the documents in my storage (files, folders) by applyingg complex filters. Initially, client ...
-1
votes
1answer
60 views

Resful name API for multiple key objects

We are implementing an API and we want to follow best practices for naming the endpoints. However, during the design, we have found a challenge. We have some objects where the key to the objects is a ...
2
votes
3answers
194 views

Dealing with API errors

I'm building a shop system which works in three parts: a mobile app (Android/iOS) which is used by customers to make orders, view products and so on, a desktop application, used by the managers to ...
2
votes
5answers
562 views

Can Dependency Injection be overkill?

At what point does dependency injection make sense? When I first learned about Guice I was really excited. I have a Concurrency module, which is basically just a singleton controlling concurrency. I ...
0
votes
2answers
81 views

Are REST Methods Which Return Dynamically Generated Random Data Safe

Is a REST method which returns dynamically generated random data each time that it is accessed considered safe? According to RFC 2616 (emphasis mine): ... In particular, the convention has ...
0
votes
2answers
84 views

Incorporate a background job enqueue endpoint in a REST API

To exchange data between our standalone frontend application and the backend API, we currently have a REST API, with standard endpoint to list/create/update/destroy ressources with a consistent naming ...
1
vote
2answers
79 views

RESTful API - Adding nested resources as a query parameter?

I recently had thoughts on handling the flat vs nested architecture when designing a RESTful API. Would there be anything wrong with having a system where your nested resources can be specified ...
0
votes
2answers
70 views

Should the consumer of an API always be the one that should Adapt to the API Spec provided? [closed]

One Premise I worked under for API development is "The Consumer of the API adapts to the API." For example if I call Yelp or Twitter API I have to adapt to it. There is no way they are going to ...
0
votes
3answers
89 views

API with different kind of response for error

Let's focus on a single endpoint, which always returns an encoded JSON object with a well defined and documented structure. But when an exception is thrown, the exception itself is formatted to a ...
0
votes
3answers
108 views

Url pattern for making a 'like' with a REST API

I have an API route as so: GET /api/item/like Which makes a like object between the logged in user and item object, and it works fine. Is this the correct way to have a user 'like' an object? Or ...
0
votes
1answer
25 views

Landing API Requests

I think this question is simple, but I'm not often designing APIs and so I haven't confronted it: How far should we go to adhere to the single responsibility principle? Let's say we are implementing ...
2
votes
1answer
104 views

Microservice API Design Pattern

I'm new to the application architecture world. I walked through Docker's sample voting app, and see that basically everything that can be made into a modular piece, is made into one. I'd really like ...
0
votes
2answers
63 views

How to handle a request to delete and post?

I am making an application in which there are 3 tables. A user can click a button to request to move an item from table 1 to table 2. Essentially, this means that an item is deleted from table 1 and ...
0
votes
2answers
67 views

Develop based on my current requirements only? [duplicate]

I've a service called Claims-Service which has following signature: IClaimsService { EnsureClaim(claimType, userId) } It queries database to see if the claim is present in any of my roles or not. ...
0
votes
1answer
91 views

C Function returning pointer to first element vs. a pointer to an entire array

Suppose I have an API function which returns a pointer to some memory, that is later to be consumed in an array-like manner. Suppose also that its size is known in advance, and that it's declared like ...
0
votes
1answer
44 views

How to handle many-to-many relationships with multiple incompatible relationship types in RESTful API?

Note this question is about when there are multiple relationship types. This is not the same as this question, where there is only a single member relationship. Say we have persons and organizations. ...
0
votes
1answer
211 views

Handling Different Parameters for Derived Classes

I'm designing an API and I ended up having a few pure abstract classes. Because of the nature of the problem that I'm solving, each derived class has to be initialized with different sets of ...
1
vote
3answers
125 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
1answer
166 views

Should “NaN” default to SNaN or QNaN

I created a function to read floats (IEEE 754 binary 32-bit) from strings, for developers. I have everything finished and working perfectly, except i'm wondering if a user/or programmer enters a ...
3
votes
2answers
189 views

Designing a builder as a compile-time state machine

I'm working on a text GUI library which comes with builders for UI components (Buttons, Panels, etc). I have a base class for these builders which I'd like to redesign so that meaningless component ...
0
votes
0answers
58 views

How to cope with terminal operations in a fluent API?

I am trying to polish my data-mapping library and struggle with my fluent API design as it feels clumsy in some basic use-cases. The library focuses on defining mapping objects from one type into ...
0
votes
2answers
232 views

Load Balancer / API Gateway availability or is it a single point of failure?

I'm developing a microservice system. I have a discovery service (Eureka) for all my services and an API Gateway (Zuul) to call each service via an URL. My problem: How can I assure that a service ...
0
votes
1answer
37 views

How to deal with non-existing parent resources in url?

I've microservice, let's name it Employee. It only has employee logic, but there's a "foreign key" to the (not really) related company. There's no company resource and no company logic in this ...
1
vote
1answer
290 views

How to structure your URIs?

I am making a web UI and an HTTP API for editing JSON documents in collaboration (role and versioning system). There are several types of JSON documents. Each type is described by a JSON schema, let'...
0
votes
1answer
79 views

REST API Client Library Design

I'm working on a reusable client library to abstract a REST endpoint that we use in many of our in-house applications. It is actually split into 3 APIs, and certain endpoints/resources require ...
-3
votes
1answer
43 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
100 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
2answers
80 views

Are different endpoints to display the same resource in different ways RESTful?

Say I have a Student who has a ID number, a name, a profile picture, some contact details, and is enrolled in several courses. From the perspective of a Single Page Application there are different ...
0
votes
3answers
234 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
222 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 ...