Stack Exchange Network

Stack Exchange network consists of 174 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]

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

2
votes
6answers
186 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#...
1
vote
1answer
52 views

Is GraphQL REST compliant (almost)?

I am writing an article about traditional REST vs GraphQL. However, after doing some research about REST (not just a specific implementation of REST), I started to see that GraphQL actually abides to ...
2
votes
1answer
68 views

params T[] vs IEnumerable<T> as parameter type

I know there's a proposal for params IEnumerable<T>. When designing an API, when should we choose params T[] (params array) over IEnumerable<T>. Or should both be implemented for better ...
2
votes
3answers
156 views

Should you retry 500 API errors?

My team and I are integrating with a 3rd party company and using their API to perform different CRUD operations. Their API isn't always reliable though. Maybe 0.1% of the time an API call just fails ...
-2
votes
1answer
50 views

Method that takes array parameter [duplicate]

I want to implement two methods: AddPlayers and AddPlayer. Is it better when AddPlayers calls AddPlayer or AddPlayer calls AddPlayers with a single item array? Is there a significant difference in ...
3
votes
3answers
139 views

Is checking if something exists responsibility of a caller or an API?

Is it better for an API when it provides additional methods that check if something exists before adding? For example: if (!userManager.HasPermission(user, "somePermission") userManager....
0
votes
1answer
46 views

How to structure a set of classes that deal with external APIs for maximum testability?

I'm developing a set of classes designed to communicate with external APIs, and I'm running into trouble with how to properly structure everything for proper loose coupling and unit testing. ...
0
votes
0answers
38 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 ...
1
vote
2answers
77 views

API design - indicate that results were truncated

For reasons, my search endpoint returns a maximum of 50 results. I'm struggling with how best to tell the caller that their results were limited to 50. The best I've come up with is returning some ...
0
votes
0answers
28 views

When is an API Manager/Gateway product necessary? Would you use it for Backend For Frontend services?

I have been using different API Management solutions for quite some time now, as some clients encouraged or forced its use to manage APIs and microservices. However I feel in many cases there could ...
-1
votes
0answers
31 views

Can API authorization relay on api contract?

an example: user authenticated with token, some property in contract must be witihin the set user is allowed to send, like order type 1, 2, or 3. User sends 4 which is also possible, but not for him, ...
1
vote
0answers
17 views

Handling coherent state changes in DB through API

A simplified version of my DB: Appointment id INT PK datetime DATETIME AppointmentChangeRequest id INT PK user_id INT FK appointment_id INT FK request_datetime DATETIME ...
0
votes
1answer
90 views

Should I access the backend directly or through an API layer?

Please allow me to ask my question using an example where we have a database with flight data and I want to make a web app where users can search, select, and book a flight. I wrote some classes ...
-3
votes
1answer
84 views

Correct response for API, 404 or {response: “not found” } [closed]

I'm not sure on the correct procedure for returning a status code for a GET request in a RESTful API request. Lets say I make a get request to get a users details from the server. However that user ...
1
vote
1answer
43 views

Separation between regular web site requests and API requests

I have a doubt about the architecture of a web app when it comes down to differentiating between regular website requests and API requests. For the purpose of explaining, suppose I am the creator of ...
0
votes
3answers
62 views

Nesting Objects without Passing Arguments?

I have a couple of classes that I've nested together (not in the sense you may think so bare with me), to create what I call a prefab object (similar to Unity's prefab system). In this particular ...
0
votes
0answers
88 views

Who is the copyright holder when GLPv2 project API is used? [migrated]

I've read a lot of articles and still can't find the answer to the following question. There is a project that uses GNU General Public License version 2 license, developed by CompanyX. We (...
1
vote
3answers
151 views

Does providing multiple APIs reduce code re-use

Within an organisation, suppose you have an internal tool used by different teams and for different use cases. This package offers APIs in different languages. One could say that having multiple APIs ...
1
vote
0answers
33 views

Difference between API server and Gateway

I'm working on a VOIP startup currently and deciding which software stack will be best. I'm doing a lot of research of how other people do it, like Discord. It's really hard to make some of these ...
0
votes
1answer
48 views

Exceeded limit for API pagination

I'm implementing an API with pagination which has max_results that can be specified by the client. The server will have a hardcoded limit, for example 100 results per page. In the situation when the ...
0
votes
4answers
131 views

In API design, if I request a list of objects by ID, and one of those IDs is invalid/deleted, should the request fail?

Let's say I'm requesting a list of IDs for which I'd like to receive relevant DB entities (e.g., my-restaurant-api.com?restaurants=1,2,3). In this example, let's say ID 3 has been deleted and should ...
0
votes
1answer
30 views

Cross-domain data binding

I've been developing several front-end web-applications recently that bind against a database using a RESTful CRUD api. I've noticed a massive amount of boilerplate code going into defining the API. ...
0
votes
1answer
83 views

Composition of microservices. Good or bad thing?

Hopefully this topic is not opinionated and I could maybe get meaningful answer please. Our problem is, imagine you have two microservices: Car and Driver. DTO of the driver could be let's say as ...
-1
votes
4answers
118 views

When streaming JSON to end users, should each buffer be standalone JSON?

If you were streaming JSON to the end user, and every "buffer" of response was in the format of, for instance... { "something": "here", "other": 1} You'd be in a spot where the entire stream ...
4
votes
5answers
383 views

Should we tailor APIs to the customer, or ask the customer to use the existing one?

I am a sole developer and I recently wrote a new web application in the form of a API with Swagger and front-end. This was customers could use the API on their own, usually forscripting. It is ...
1
vote
1answer
145 views

Can (Java) Interfaces be referred to as APIs? [duplicate]

I am trying to understand what exactly an API is. From my current understanding, an API (Application Programming Interface) is a contract provided by a software instance, that guarantees a defined ...
0
votes
2answers
60 views

Preferred method signature for API method involving DB interactions

I recently got into discussion about how the method signature should look like for an API method which doesn't expose internal objects used by application to caller. Here is how situation looks: Our ...
0
votes
1answer
41 views

Can websites written in JavaScript make requests to SOAP API's?

I have an API written in SOAP 1.2 that I am trying to give to a developer whose website is written in Javascript and said they can not request the file because they do not know PHP. From my ...
2
votes
4answers
142 views

User calling REST APIs on behalf of a different user

Here's an example: GET /posts POST /posts GET /posts/{post_id} PUT /posts/{post_id} This api is being used by SUPER_ADMIN as well as CONTENT_WRITERS. Its working great. If user is logged in as a ...
0
votes
0answers
50 views

Challenges in Consuming Slow API's

We need to integrate a chatting software in our web application (and mobile app). The chat software could be accessed by our users from outside of our application too. The integration goal is to let ...
1
vote
2answers
116 views

Is it good design to provide interfaces in a library that would only be used for unit testing?

Contrapositive-ish question: What is the design reason a library class would not implement an interface as a convenience to the developer? (e.g. the .Net library class FileInfo) The FileInfo class ...
0
votes
1answer
56 views

Is there an equivalent to HTTP status codes for WebSockets messages?

I'm developing a WebSocket API and I was wondering if there was either a standard or best practice for responding to client messages. For example, if my API is expecting only stringified numbers but ...
0
votes
2answers
97 views

Check or not objects in a Javascript API?

I'm writing an API in JavaScript, and I'm confused whether or not I should check if the API user is passing me the correct type on which the API expects to work. Actually not the type, but if you are ...
0
votes
1answer
47 views

Fastest way to return a list of records depending on many many-to-many relationships

I'm developing an API in Rails and the following requirement is established (it's really more complicated, but I want put a simple example): There are users and messages. users have a gender (...
0
votes
1answer
101 views

What HTTP action and return value should be used on resource's action

I have a question about how I should implement a new action for a resource on my API layer. I have a Timesheet which is used by people to let us know how many hours they worked on a job. This ...
5
votes
4answers
176 views

How to expose field constraints using HATEOAS?

For example we have entity object: { "id": 10, "name": "First object", "status": "new", "manager_id": 200, "links": [ { "href": "self", "type" : "...
0
votes
3answers
147 views

How can a headless client securely know the API version of a multi-instance backend?

I'm working in a scenario where I have a backend (let's call it the server) and a frontend client app (let's call it the client). The client is entirely headless, and can connect to any instance of ...
2
votes
5answers
364 views

In a REST API, should you correct user input on server side?

We have a REST API with an endpoint accepting JSON data from the client. One of the JSON fields is a URL that will be rendrered to other users as a hyperlink to a website page associated to the ...
0
votes
2answers
122 views

New version of REST API - deploy two services?

Assume you need to define a completely new REST API for a given service. These rest APIs are distinguished by something like "v1" and "v2" in the path. If you develop these services in Java, would ...
1
vote
1answer
94 views

Best practice API design for mobile app in sending multiple photos in one request?

I'm working on API design for a mobile app where the user can send one or more photos that will be stored in the database. Currently I have three routes, post photo/create which will send one photo ...
0
votes
1answer
115 views

Should I opt to not use someone's API?

At a job that I recently started, I inherited some of the projects from the guy who previously held this position. One of the projects was a program that used a Website Platform's public API to get ...
2
votes
2answers
248 views

Hiding raw pointers from public API but need to pass them internally - design review

I am designing and prototyping an ncurses C++ wrapper. It's a hobby project, nothing too serious. I will omit include guards and stdlib includes etc. Consider the following files: application.hpp #...
1
vote
2answers
93 views

C++ - Is it a good idea to make separate headers as API?

Let's say I have a library code main.cpp, where are 3 classes implemented: Inner1, Inner2 and Outer. Inner1 and Inner2 are only being used in main.cpp and they're not going to be used anywhere else. ...
0
votes
0answers
42 views

What goes in the meta attribute in an API

I am using the JSON:API standard to write my API: http://jsonapi.org/ An example is as follows: { "data": { "type": "offer", "id": "1", "attributes": { "title": "50% off!", ...
1
vote
3answers
235 views

Designing a REST API with resource relationships?

I'm working to design a REST API to be consumed by a React SPA. The client-side of the SPA queries data about a relationship between two entities: Team and Player where Teams have many Players and ...
0
votes
1answer
42 views

how to deal with collection of different type of resource

I was wondering what was the best practices in terms of collection of resource ID of different types. My software has a service for each resource, each of this resource has a unique id (hexadecimal ...
3
votes
1answer
110 views

How to deal with friend requests in social API REST

I'm designing an API that a social network app will consume. I need to manage friend requests between users. I have this endpoint: POST /users/{userId}/friend-requests { requesterId: string } ...
0
votes
1answer
99 views

API Design - User Management

I work for an ecommerce site and we are looking to expose much of our core functionality via a set of APIs. We plan on re-writing some of our own public facing websites (e.g. the main shop website) to ...
0
votes
1answer
131 views

How to handle API responds with DTO or Error Message

I have a mobile app and an API. The mobile app is set up to expect back a DTO from the API but has no information if an request was unsuccessful. This needs to be updated so that better messaging is ...
1
vote
3answers
257 views

multiple frontend apps 1 backend api

I need to build a few (2-3) different systems (frontends), they will have different uses and users, however the data for all those systems is in 1 DB. example: 1st system is a customer facing site ...