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
Join us in building a kind, collaborative learning community via our updated Code of Conduct.

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

0
votes
1answer
39 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
92 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
53 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
44 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
90 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
34 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
57 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
209 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
38 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
204 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
95 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
58 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 ...
6
votes
4answers
217 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
66 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
51 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
124 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
225 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
160 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
32 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
33 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
69 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
8k 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
128 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
38 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 ...
1
vote
0answers
70 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
31 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
38 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 } ...
0
votes
1answer
132 views

Best practices for calling multiple APIs and manipulating data before showing it to user?

I am building a web application that makes use of multiple API's (Google Maps, Weather APIs, and more). I am using Python + Flask on the backend, and Javascript (probably with React, I have not ...
0
votes
0answers
60 views

API Authentication with JWT by reference

We are in the process of rewriting our API and would like to have some advices. Requirements: Authentication will be done from various clients (mobile app, browser extension, single page app) ...
0
votes
1answer
146 views

Preventing abuse of API which is called via client side Javascript

I'm setting up an AWS API Gateway + Lambda micro-service that will return non-sensitive but user-specific data.This means that the responses from the service can't be cached and served to multiple ...
0
votes
2answers
186 views

RESTful API Relationships

Lets say we are making an API with two resources: Author and Book where books can have many authors and authors can have many books. So we design the REST api like so: /books /books/:id /books/:id/...
-2
votes
1answer
84 views

When to use a proper API and when to use session state?

I was looking at this documentation. https://laravel.com/docs/5.6/passport it is quite long and I asked myself, why would one use this, over just a normal login where you store necessary information ...
-1
votes
1answer
134 views

ORM vs Web API differences

I'm struggling to understand the differences between an API such as a REST API and an ORM such as Entity Framework. I would also like to understand the benefits of each and in what situations either ...
0
votes
1answer
84 views

API design for multi-tenant web app - how to identify users from another system?

I have a multi-tenant web application that allows authenticated users to make changes to their application instance - making comments as an example. I'd like to build an API that allows a user of any ...
2
votes
2answers
89 views

Should a POST endpoint in a REST API allow the inclusion of related resources?

Given the following REST endpoints: (GET, POST) /api/v2/employer (GET) /api/v2/employer/{id} (GET, POST) /api/v2/employer/{id}/employees Should a consumer of this API have the ability to ...
1
vote
2answers
97 views

My implementation accepts only URLClassLoader, may I be less restrictive in my method signature?

I wrote a Java API that accepts ClassLoaders as parameter, even though it won't accept any ClassLoader that isn't a URLClassLoader (because I'm only interested in the URLClassLoader::getURLs() method):...
0
votes
0answers
20 views

How to unit test an SDL based frontend? Is it worth it? [duplicate]

I am currently beginning to create a small program/game in my free time and decided to try out SDL2 for my frontend/graphics code. I use the bindings from SDL2-CS, which is API-wise very close to the ...
1
vote
1answer
71 views

Test RESTful APIs?

When testing RESTful JSON APIs with ATDD/BDD practices in mind is it good practice to test the structure of the response? I'm thinking that it could too easily change, thus making for a brittle test. ...
0
votes
0answers
32 views

Building a graphql api in php, async or not?

Coming from a previous task of building a graphql api in node I was asked to do the same thing for php. We started defing the components/tooling of our project and we went for what we know best in the ...
2
votes
1answer
66 views

Design: Update properties on an entity in a RESTful, resource-based, API

I am working on a RESTful, resource-based, API and I have a large entity (an account) with a lot of properties (30, we'll say). The account has a couple of properties that can be changed... Name: ...
1
vote
1answer
106 views

Rewriting an old, broken desktop application via a local API

We are currently supporting a very outdated, unstructred, untested and unstable ERP desktop application coded in Windev (on windows). As the days go on, we need to add more features for the users but ...
0
votes
1answer
49 views

Restful API Design: Best solution deal with data change immediately after return pagination data?

The client call api to query the list of products that were sorted by the number of pageview in descending order. Sometimes it happens trouble case: The client A send a request => server response the ...
3
votes
2answers
114 views

API across multiple languages. Use idiomatic code for each or support the same API structure

I'm currently working on a project which requires to support multiple languages as first class citizens and I'm facing a dilemma. I can choose between implementing the API as closely as possible for ...
1
vote
1answer
47 views

Flexible image REST api with cdn and caching

Consider a social network in which a user photo is needed in different resolutions large/small/medium etc. When the photo is uploaded, I do not want to make the user to wait too long for the image to ...
3
votes
3answers
113 views

Handling domain errors in the API

I'm working on building an API interface on-top of a domain-driven architecture. The domain layer has a bunch of specific exception classes (i.e. NameIsRequiredException, CannotPublishDraftException, ...
1
vote
1answer
107 views

Designing a flexible search API response

Quick Summary I'm building a search micro-service that will allow searching across different types of resources in a particular system (e.g. blog posts, users etc.). The API that will be exposed will ...
1
vote
3answers
272 views

Proposed Method to Restrict API Access to Mobile App Only

I read a lot that you can't restrict your Public REST API to only your mobile application, but I have an idea and I want opinions on it: Variable App Key Method Mobile App Get IP address of current ...
0
votes
0answers
36 views

Justifying centralised api for data access?

We have been asked to develop a centralised API for the querying and serving of all sorts of data from across our business. This is a mix of older standalone applications and newer web-api based ...
3
votes
1answer
469 views

Use DTO Pattern or Serialize Domain Objects

A colleague of mine is against using DTOs and rather feels we should just return Entity / Domain objects serialized for a REST api. He feels DTO is an anti pattern and sited this article Data Transfer ...
4
votes
2answers
202 views

How to properly use a database containing common tables in a multi-application system?

I'm trying to determine the best application and database architecture for a project I am working on. The idea is that there will be multiple, separate applications that will all share a few tables ...