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.

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

0
votes
1answer
47 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 ...
-1
votes
1answer
55 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 ...
0
votes
1answer
89 views

Professionalism of implementing the HTTP “QUERY” method in an API

Some years ago, the w3c documented a proposal for a method called QUERY, where query information may be passed in as the request body rather than on the request line in query parameters. You can see ...
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: ...
0
votes
2answers
52 views

RESTful API authorization for updatable fields

I've got a resource as follows where state is a enum: { id: 123, industry: { id: 245, name: "Farming" }, "scheduleDate": "2018-01-01", "state": "Requested|Approved|Standardized|...
1
vote
1answer
33 views

Dependancy mangement for facades/adapters to cloud services (SemVer?)

Suppose I have a library, that basically works as a facade to some cloud service (e.g. JavaScript API that wraps around network calls to some RESTfull service). And once that service introduces a ...
2
votes
1answer
63 views

Web API: REST-ish pattern for flexible querying of time-series data

I'm working on a product that exposes a RESTful API to interact with system entities (the usual CRUD), which works very well. In addition to CRUD, we've recently encountered a need to expose the ...
-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 ...
0
votes
0answers
54 views

Compute and assign value to an attribute during class instantiation python

I am new to OOPs and don't have software engineering/computer science background. I am trying to define a class where I want to compute and assign a instance attributes under def __init__(): as ...
-1
votes
1answer
96 views

API gateway for web-fronted applications, is it worth it?

So am in the process of developing a new application and am welling to adopt a micro-services based architecture (am new to that). The problem is that the application will be exposed to the final ...
-2
votes
0answers
43 views

GO backend integration

I am working on a backend system that requires concurrency and I choose GO for its goroutines I am wondering if the best way to integrate GO into the system would be to create an API that the existing ...
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 ...
1
vote
3answers
85 views

HATEOAS APIs and front end development

We are developing a tool from scratch based on a Spring backend and VueJs frontend. I am primarily working on the backend and came to know about the HATEOAS principle of developing REST APIs and ...
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 ...
3
votes
1answer
60 views

API design and storing custom queries from Db to cache

I was thinking about how people actually implement utilising results from a cache before a doing database lookup. When designing an API, should there always be a manual check to the cache first before ...
1
vote
1answer
24 views

Determining tenant for anonymous multi tenant api endpoint

I'm in the process of building a new api that needs to support multi tenancy. I can figure out how to implement reading and writing the data securly without having to worry about clients being able ...
1
vote
0answers
30 views

API Architecture Decision on Authorization & Validation levels

We are designing an authorization mechanism for a Product API where users have their own claims. The api has a patch request like this: PATCH https://product-fcd.com/api/product -d {"Products": []} -...
-1
votes
1answer
37 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
1answer
61 views

API internationalization

I have a question about architecture and I would like to know your opinion. Given a product formed by an API and several consumers (Android apps, iOS apps, web apps ...), where should I implement the ...
1
vote
1answer
101 views

How to solve duplicate logic in a microservice stack

I have designed a microservice stack with docker as backbone, about 50 services in total so far, still growing... Everything works well, happy with the design choice, but room for improvement. I ...
0
votes
0answers
16 views

API design for mobile mapping application

I am working on a mobile application that displays a map with various markers, these markers come from a multitude of third-party APIs. The concept I had in mind was to develop a web app hosted on ...
36
votes
5answers
5k views

How to describe an architectural shift that intentionally breaks REST standards?

I'm proposing changes to a very poorly architected software project that suffers from a multitude of problems. At a high level the project utilizes Angular on the front-end and consumes various REST ...
0
votes
0answers
59 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) ...
1
vote
1answer
136 views

Use Case of HTTP GET Request with a Body

I am maintaining a old .aspx page in which all the data required by the page to show the content is passed in the URL of the GET request as a part of query string. The result of this is that, as we ...
0
votes
2answers
169 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/...
8
votes
5answers
512 views

Designing function based RESTful API

Please settle an argument between me and a friend. We'r currently designing a product API. Our Product entity looks like this { "Id": "", "ProductName": "", "StockQuantity": 0 } Product ...
-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 ...
8
votes
3answers
1k views

Reasons behind non-intuitive C# String.Split() implementation

In C# if I want to split a string by another string I have to do something like that : testString.Split(new string[] { "anotherString" }, StringSplitOptions.None); From the overloaded String.Split ...
0
votes
1answer
83 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 ...
0
votes
2answers
51 views

API responsibilities vs Client responsibilities (Characteristics of returned data)

I have a hard time trying to find a 'rule of thumb' to follow when dictating certain responsibilities to either the API, or the client-side code base. For instance, if I know a dataset should be ...
3
votes
2answers
113 views

REST Resource Validation: Conditionally Required Fields Vs. Separate Resources

Is it better REST API design to use conditionally required fields or to create different resources based on the controlling field's value? Here's an example: POST route/automobile { "type": "car", //...
0
votes
2answers
141 views

Single page apps and backend APIs

When creating single page apps that communicate with a backend API via ajax, what is common (best?) practice regarding updating different server side database objects as a result of one client side ...
1
vote
3answers
143 views

difference between expected inputs and implementation details

During a code review, I suggested to my coworker that he had questionable parameters for one of his methods. In particular, the parameters revealed too much about the method's implementation details. ...
1
vote
2answers
103 views

Consume own API or make independant website

The PHP framework Laravel allows to make an API and a website on the same application. As both of them will communicate with the same database, I was asking myself what is better between consuming my ...
1
vote
1answer
56 views

B2B vs B2C services - are differences purely relates to business process and flow OR are there differences also in technical architecture?

I have some B2B services already exposed to customers who manufacture products and ships to end consumer. These B2B services are implemented using asp.net web API and is performant enough to handle ...
1
vote
1answer
154 views

Limitations of using classes as interface

I am an Electrical Engineer now training and working as an embedded software developer, so I have little formal computer science and software design training. I have until a few months ago only worked ...
2
votes
1answer
64 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
2answers
164 views

Implementing interfaces vs using a base class

I am writing an application in python. The part I am little confused about is providing a little structure to my code. This is the basic requirement of my web application. I have these different ...
0
votes
0answers
75 views

Conflicting opaque struct implementations as part of a C API

I am currently toying with the idea of designing a somewhat sophisticated C API. I have looked around existing APIs and found an interesting approach revolving around opaque structs. Specifically, I ...
1
vote
0answers
27 views

Storing laravel API tokens from one API in another APIs env file

Last year my company started using Laravel to build APIs, and we created two separate repositories - one for a primary API and then a second for a secure API that would only accept requests from the ...
5
votes
4answers
296 views

How to minimize a Java library's exposed interface surface while breaking down the library into subpackages?

I'm making a library or two for and Android app and I want to keep the library's exposed interfaces to a minimum to avoid the abstraction leaking everywhere by avoiding making all of the classes '...
0
votes
0answers
42 views

API searchable with pagination and faceting

I have a Rest API that enables searching/sorting/faceting and pagination using spring data solr and spring web. I have managed to produce a json output like: { "_embedded": "objects": [ ...
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 ...
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 ...
2
votes
1answer
56 views

DDD - What could be best fit for AggregateRoot and Entity for Transaction Domain

I'll preface this question by saying I am relatively new to DDD so I may be making some fundamental mistakes here! I am working on a project which involves the concepts of Transactions (in the ...
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
106 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
0answers
31 views

Graphql design - more queries vs more variables

I'm trying to understand the drawbacks and advantages of designing a graphql API in two ways. One way is to normalized top level queries and uses variables to provide different functionality. The ...
0
votes
0answers
50 views

how to implement One-to-Many server-client data transfer where only new documents are transferred

The problem is regarding client-server data communication in the context of REST web service and database design. let's say we have Runners and Visits to fulfill, each Visit is assigned to a Runner, ...