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.

0
votes
0answers
15 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
38 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
129 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
47 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
110 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 ...
-2
votes
0answers
34 views

Backend, API, Frontend confusion

I have experienced hard times to decided which way to go. I try to illustrate with an example. I have a project. lets say todolist app. It will be web application, mobile applications and public API ...
0
votes
0answers
42 views

Do you aggregate your APIs into a single FQDN?

Currently we have one API running on server1.example.com, and though we'd publish the API behind our load balancer using a dedicated FQDN like this: api.example.com/cars -> server1.example.com api....
0
votes
1answer
54 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 ...
-2
votes
0answers
53 views

Scaling PHP API for 1000 request per second

I have a task to design a POST API to serve 1000 request/sec. Right now I am developing on 4 cores 4 gb ram. From Apache ab it is showing 37 requests/second. <?php require 'vendor/autoload.php'; ...
0
votes
1answer
45 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
61 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 ...
2
votes
2answers
80 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
143 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 ...
-1
votes
0answers
16 views

Realtime Sensitive Data Scan

Is there an API / Library that would do real time scan of string and identify if it contains NPI data? I need this for adding validation to free text UI fields where customer may inadvertently provide ...
2
votes
5answers
339 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
98 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
63 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
113 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 ...
0
votes
1answer
184 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
90 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
39 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
127 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
41 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
107 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
84 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
76 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
146 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 ...
0
votes
0answers
43 views

Apache Kafka as an integration layer

We are creating an application that needs to interacts with a 3rd party API. First we were communicating with this API using HTTP requests, but now someone suggested we use Kafka instead of HTTP ...
-1
votes
1answer
64 views

APIs: Many minimal ones or a few bigger

I'm currently working on a project/product which consists of ~60 REST APIs and one client (Web app) I find many downsides on this design, and not so many benefits, and I'd like to know if this is ...
4
votes
2answers
219 views

Is it violation of single responsibilty to add a method to an existing API

Say i have a Rest API that has a POST and GET method. If i want to overwrite a resource in the API i can call the GET method to get the original item and then call the POST method to replace that ...
2
votes
1answer
40 views

recommendations regarding resource uri

lets say we have a "door api" and I want to create a resource to close the door. I could do this in 3 ways: traditional way using PUT with payload {id: XX, color: YY, closed: true} advantages: ...
1
vote
4answers
211 views

Can we call a paid API a SaaS?

Is it technically correct to call a paid API, e.g. APIs provided by TimeAndDate.com, a SaaS? The reason of asking is that I was having a discussion with someone who was of the view that we can't as ...
1
vote
2answers
98 views

Define a complex query in JSON sensibly

A bit of background. We are in the design phase of an HTTP API, and we are facing the question of how to define complex queries in JSON format. We have a items in our product that have A LOT of fields ...
1
vote
1answer
59 views

Collection of APIs making up one Application - How to manage?

We have inherited an application that is made up of small .NET web API's. Each API has its own Visual Studio SLN and git repo. All of the APIs are published to one folder ("All") and that folder is ...
7
votes
4answers
330 views

Pagination with API

I'm currently building an opensource administration interface to help people easily manage their contens/websites. Application built on Vue.js and heavily rely on json configurations for which fields ...
-2
votes
1answer
68 views

Should I use a strongly typed programming language for an integration with a JSON RPC 2.0 API?

I have to integrate with another company's API, which they unfortunately decided to write in JSON RPC 2.0. If you're not familiar with JSON RPC, it's a lightweight RPC protocol that defines a ...
1
vote
2answers
54 views

API - editing subset of attributes

Given a resource for which only its subsets of attributes can be edited, {E.g. invoice (resource) with a status (attribute) and paidAmount (attribute)}, in terms of API design, which amongst the ...
2
votes
2answers
131 views

When consuming an api, what is a good way to deal with their request limits?

My app is consuming a third party api. One of the requirements of this api is that my app cannot send more than 20 requests per second. Because of the nature of this app, and because my user base is ...
1
vote
3answers
227 views

Programming Language Interoperation for Website

Say I have one website created with the LAMP stack and another with the MEAN stack. I want to create a program which estimates the entropy of a password so that I can add a password strength meter to ...
0
votes
4answers
281 views

Rest API Design in case of partial success

So I have a ticket booking system. I have ticket booking request on api, from my application we call payment service. If failed on first attempt we proceed by adding message on queue for handling ...
2
votes
1answer
40 views

Gradle/Java separation public private API

I have a project that has a public API and an internal code. The public part is published on MavenCentral. I thought about making a package each, but everything from the 'internal' package that ...
0
votes
1answer
34 views

What are good strategies to use for learning the workings of larger systems? [duplicate]

For obvious reasons (be a better developer) I desire to gain a deeper understanding of not just my code, but the systems / frameworks / libraries that I work with. As a senior-ish dev* I feel I should ...
1
vote
1answer
72 views

API Architecture: Should the API update the database on it's own? Or should there be another service to tell it to update the database?

I am working on a project which has a requirement to records in the database every day. I currently have a REST API which does the usual CRUD functions. Should I create a service within the ...
48
votes
10answers
9k views

What should be the http status code for “Service not available in your area” error?

Our service is in 5 cities right now. If someone tries to call our service API from any other city, we want to throw this error Service not available in your area. The question is, what is the ...
-1
votes
1answer
129 views

How can I prevent my API from being accessed by anything but my website?

I've got an API (Java + Play Framework). I've got a website (React) who has to communicate with the API. I don't want my API being called by anything but my website. How can I do?
-1
votes
1answer
39 views

Advice on accessing an API Service

I have a requirement to validate a data field (a reference number for payments) in our finance system by connecting to one of our vendor's API services. The finance system does not have the ...
2
votes
0answers
147 views

Migrating a client from a REST API to a WebSocket one

I'm working on a system that integrates with several third party services via APIs. Those services require authentication. Usually, the services are implemented as REST APIs using HTTP. My system ...
0
votes
0answers
34 views

GraphQL - should i enrich it with hypermedia

I know that GraphQL and REST are different approaches. But what if I need to provide hypermedia links and state transitions to my API design besides agile queries? Should I expose 2 different layers, ...
0
votes
0answers
41 views

How can I group related functions within a use case?

Context In the context of a GraphQL API let's consider this query: query { blogPosts { id title body author { id name } ...