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 [api-design]

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

2
votes
4answers
302 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 ...
-1
votes
2answers
81 views

How to handle an API that reuturns a pointer to an array of a runtime-known size? [on hold]

Suppose I've got a struct declaration that looks like this: struct Return { myData (*data)[]; ... } Now suppose I've got an API function whose declaration looks like this: bool API(..., ...
0
votes
0answers
20 views

How to display linked third party sign in methods

I am writing an app. Like Google suggests, the user should be to be able to link multiple sign in methods to their account. In order to do that, the ideas of "identities" and "accounts" are separated ...
0
votes
2answers
66 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
62 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
74 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
66 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
83 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
101 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
23 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
88 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
61 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
65 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
81 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
30 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
182 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
121 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
134 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
157 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
55 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
133 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
35 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
282 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
72 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
41 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
95 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
73 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 ...
1
vote
1answer
162 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
139 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
vote
2answers
57 views

API Microservices bundle multiple services as one deployment Vs separate deployable for each service

So I am going to be developing atleast 5-6 Res end points . ( all distinct and stateless ) Now I am debating on the following: Should they be combined as single war / ear or deploy each service ...
1
vote
3answers
98 views

Affecting the behaviour of a REST API POST

I have an API that has a POST method to create a new Product. The creation of the new Product is handled by POSTing to a ProductService. Now I want to be able to instruct the API when creating the new ...
-1
votes
1answer
145 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 ...
2
votes
2answers
181 views

Should smart pointers be exposed in a C++ API?

Exactly as the name says, should smart pointers be exposed in a C++ library API? I've used quite a few C++ libraries and haven't ran into exposed smart pointers yet. Given that it's very common to ...
3
votes
2answers
101 views

How do I create database records based on rules?

I'm creating an application in which people meet certain criteria to receive a payout at certain milestones. In order to earn these milestones, users will record activity in a log, and when they have ...
4
votes
1answer
237 views

How to properly version an API?

I'm designing an API for our web application, that will be consumed by mobile developers that will create our mobile app. I chose to document it using Swagger / OpenAPI 3.0.0. I'm surprised that ...
0
votes
1answer
51 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 ...
4
votes
2answers
246 views

Heavy task exposed via a REST API

A part of a system I am currently reviewing, consists of a master node which calls several slave nodes using REST APIs. The slave nodes are scattered throughout the world on different servers, and ...
2
votes
1answer
86 views

How to design document exchange system

I am trying to come up with a design of document exchange system. System should be for business-to-business communication. Description: There will be possibly 100+ clients(consumers) - they will have ...
2
votes
1answer
61 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
2answers
79 views

backwards compatibility of REST API for update/patch when adding new fields

Context: Suppose the current way to update a person is to use HTTP PATCH, where you can set the firstname and lastname: { "firstname": "john", "lastname": "doe" } And you want to add an extra ...
6
votes
2answers
408 views

Is it bad practice to use a single endpoint to do multiple similar tasks?

So the scenario is that I'm asked to redesign and refactor a REST API by combining multiple endpoints that do similar tasks. For example, now I have 10 different endpoints that are all used to upload ...
0
votes
0answers
98 views

Where should the API reside?

I have a microservice(opsApiServ) which hosts API to do operations(ops). /ops - POST, GET /ops-item - GET ops-item is just a single unit of operation, and ops is collection of operations (ops-item). ...
1
vote
1answer
100 views

Have generic methods that transfer DTO's from different packages, but contain same fields

I have 3 services Service A, B, C which put and get data to/from Service D +============================================+ | Service A | Service B | Service C | +==============================...
0
votes
1answer
67 views

Microservice on top of an API

I have an Odata API server that I can't change only access it, I can do CRUD operations on it. However I'd like to authenticate users, that are stored on this server. I can retrieve a user (his email, ...
0
votes
0answers
31 views

Good practices: using member routes or filter on search scopes?

I want to know which practice is more convenient having the following example, (my app is a Rails app but this can be applied on any framework) I am trying to create an endpoint which contains author ...
0
votes
1answer
82 views

Way to describe a coordinate system without external points of reference?

I'm writing an API for a JavaScript library to let my users offset an object from another. I have to provide my user with a way to describe a "vertical" and "horizontal" offset. My problem is that I ...
0
votes
1answer
66 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
3answers
206 views

Is something like “answers/{id}/downvote” considered RESTful?

Looking at Stack Exchange API docs, I see methods like answers/{id}/downvote answers/{id}/downvote/undo comments/{id}/delete. Should this be considered a RESTful API? (The docs does not mention the ...
-2
votes
1answer
73 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 ...
-2
votes
2answers
69 views

REST API acceptable design flexibility

I design and works on lot of projects involves REST APIs. But one question is always occur to me if it is acceptable way to do REST. So according to REST manuals online, REST is build upon two major ...