Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
2 votes
0 answers
105 views

When Should We Separate DTOs from REST API Serialization Classes? [closed]

We know that combining a domain entity, a DTO, and a REST API serialization class into one won't pass code review: @JsonInclude(JsonInclude.Include.NON_NULL) @Data @Builder @Entity @Table(name = "...
sfinja's user avatar
  • 129
-1 votes
2 answers
145 views

Rest Endpoint Design

I have 6 endpoints that return 6 json response: /cities/{id} return a json object: { "city": "Orlando", "altitude": 10 } /cities return an array: [{ "city": &...
Accollativo's user avatar
-1 votes
2 answers
269 views

Idempotency for a financial transaction API

Say you have a REST API endpoint like POST /move-money which transfers money from your main account to a savings pot. There are three path parameters accountId for the user's account potId for the ...
MZokov's user avatar
  • 101
1 vote
3 answers
643 views

How can I avoid duplicate annotations when validating both Entity and DTOs?

I am using the Spring Boot framework to create a RESTFUL API and I need a way to avoid the duplication of validation rules when using multiple DTOs as request/response objects for my endpoints. Using ...
Marco Pierre White's user avatar
1 vote
5 answers
772 views

DTO vs POJO (Entity) on POST request

If I have for example a User POJO like the following @AllArgsConstructor public class User { @Id private final String id; private String username; private String password; private Date createdDate;...
iqueqiorio's user avatar
-2 votes
1 answer
84 views

How to Implement Spring Boot Endpoint for Confluent Cloud-Like Batch Payloads?

I'm currently working on a Spring Boot application where I need to create an endpoint similar to the one mentioned in the Confluent Cloud documentation (link). The cURL example provided in the ...
Manupriya Logus's user avatar
1 vote
4 answers
4k views

Multithreaded processing of single REST requests

Background: We're providing an API that provides information about all users within a given group. Our API is a high level facade over another low-level REST API. To gather those information we first ...
das Keks's user avatar
  • 213
2 votes
1 answer
2k views

Best method to differentiate between two REST methods with the same pathparam (in Quarkus)

I have an issue regarding the differentiation between two Rest methods that have the same amount of path parameters: @GET @Path("image/{ratio}/") @Produces("image/png") ...
SirHawrk's user avatar
  • 259
0 votes
3 answers
167 views

Communicating error conditions in client API for remote RESTful server, what's the best way?

I'm writing an application based on a RESTful API located in a server (written in Python). An Android app will access the API endpoints to get, post, put or delete data. The usual. The server has a ...
ismarlowe's user avatar
0 votes
1 answer
37 views

Is there a set of guidelines on how to handle/code execution of Spring Microservices RESTful API calls?

I'm building a RESTful web api using Spring Microservices. I am following the Controller/Service/Repository Structure. Where can I find some guidelines on what the responsibility of each class should ...
Lucas T's user avatar
  • 753
0 votes
2 answers
2k views

How to implement resources of a REST API as classes?

I need to access and process different resources from a REST API. For this I've come up with two different approaches: Approach 1: Create one class per resource, that handles accessing the data from ...
sininen's user avatar
  • 129
8 votes
6 answers
8k views

How should an API handle unsupported fields?

Let's assume I have this API on /api/v2/persons that enables me to create new entries by POSTing this JSON: { "name": "me" } The API is implemented using Spring Boot and if ...
Marged's user avatar
  • 225
0 votes
3 answers
2k views

How to design RESTful API for response object properties dependent on request parameter

I have a RESTful service where clients provide product codes, start date and end date. In response, the service returns a list of price metrics for the products over the date range. Start date is ...
James's user avatar
  • 285
1 vote
1 answer
855 views

Java REST services - What are best practices regarding DTOs?

I've been working on a project that communicates with a service which sends very complicated REST responses. Current "best practice" on this team is that we use POJO DTOs to handle all data ...
Astrum's user avatar
  • 143
3 votes
2 answers
190 views

Checking the user in almost all use cases

I have a web application that has Users that belong to Companies. A User can only belong to 1 Company at a time and they can manage their own company information. I'm using java spring and I'm ...
Jordi Pagès's user avatar
1 vote
1 answer
6k views

Design Pattern for accessing data over RestAPI calls

I am looking out for a general design strategy or pattern designing various components in my client application. Here are high level details: The data is accessed my making a RestAPI call. The data ...
theimpatientcoder's user avatar
2 votes
2 answers
441 views

Should I create two synchronous or a single asynchronous rest APIs?

Here is the situation. System A sends the notification as it completes the work items to System B. System A does not know how many items the project consists of. It's just a pass-through system. ...
user1473349's user avatar
-1 votes
1 answer
551 views

Designing around potentially multiple RESTful API calls to a downstream service

To set up the problem, let's imagine we have a downstream service that we need to call for some information. We set up an API endpoint and call another method which will hold our business logic and ...
Astrum's user avatar
  • 143
0 votes
0 answers
75 views

How can I design a secure content verification web application?

In my country, there is a high number of fraudulent doctor's sick letter as they are manually written on paper. I'm designing a web application to combat this issue and have the whole process ...
Siya Stoan Sosibo's user avatar
1 vote
1 answer
1k views

What are the advantages of sending timestamp in the response?

I am working on REST API and it calls another service and fetch the data and return to the UI. So It does not have any direct DB interactions. Recently we added exception handling feature which uses ...
happytohelp's user avatar
1 vote
1 answer
1k views

Handling multiple REST API versions in one codebase

I have a REST API (v1) which routes through to a Java springboot component for which I now need to introduce a number of breaking changes to add new and changed functionality (v2). I understand how I ...
Durathor's user avatar
  • 119
0 votes
2 answers
984 views

A desktop app which incorporates a REST API?

I am planning to build an adapter between a PC and devices which have the same function but which have different interfaces. The adapter will probably be based on a Raspberry Pi and will have a touch ...
paul's user avatar
  • 1,191
1 vote
1 answer
194 views

REST : Static API design

Lets say, I have a scenario where I have to expose an api to fetch supported shirt sizes(small , medium and large) My initial thought was /v1/shirts/sizes - But this clashes with the existing fetch ...
Jeevi's user avatar
  • 159
1 vote
0 answers
132 views

Correct usage of ETags?

Currently my code makes a series of updates to some resource via a REST API but I also have some "rollback" logic that basically updates the resource to its original state before my updates ...
Pepria's user avatar
  • 119
-4 votes
1 answer
79 views

Which API building practice is better?

Im working on a ERP product, In which backend logics are to be APIs. Right now I have around 80 Tables. Proposal 1: Creating CRUD APIs for all tables and manipulation of data to be handled in front ...
Naveen GS's user avatar
2 votes
1 answer
495 views

How to handle db password change in a live service

Suppose I have a REST application running on a remote server which connects to a mysql database. Now let's say the password of the db has to be changed. What are the right methods and practices that ...
Jeffin Manuel's user avatar
0 votes
1 answer
603 views

Different fields for GET and POST methods in REST

I have a collection /users/{userId}/tools and I want to GET and POST to that collection. Can I have different representation of that object based on the method? For example, for POST I want to send ...
TheEmpire12's user avatar
2 votes
1 answer
161 views

Handling OAuth 2.0 access token

I am creating a rest template to consume REST API secured by OAuth 2.0. The provider has implemented an expiry for the access token for 5 mins. So Using the rest template, I will be calling the ...
Brooklynn99's user avatar
-2 votes
1 answer
1k views

Pass ID or Object which has irrelavant details as RequestBody in Rest Call?

Situation: I am designing a REST API that needs one or more, potentially large objects to do it's work I am facing a decision to either Pass the large object by reference and have the API retrieve ...
john's user avatar
  • 109
4 votes
1 answer
759 views

Is this a good design for wrapping asynchronous API calls into a RESTful interface?

I'm working with an API that has many asynchronous calls and handlers. I'd like to extend these with a RESTful interface and endpoints in spring. I'm imagining the usual Controller and Service layers, ...
user26270's user avatar
  • 149
-1 votes
1 answer
165 views

What is the best practice to insert two similar records in sql server db table which will be sent to two different destinations?

I am working on parsing a file and inserting records into SQL Server DB.The database table structure will be something like this: A Users table which contains (id, name, address, destinationName,...
Brooklynn99's user avatar
1 vote
1 answer
383 views

Designing low fault software rest API calls to achieve data synchronization between two different systems

I have been looking for a better design approach and will be providing my problem statement here with a similar example. As I don't have logic already in place but have the solution in mind which I ...
Brooklynn99's user avatar
2 votes
1 answer
1k views

best way to create @PUT upon multiple entities and compatible with RFC

I am trying to build the best PUT possible that allows modifying multiple entities upon single requests using java jersey. The idea is to send a request with multiple entity ids as @PathParam values ...
masber's user avatar
  • 327
1 vote
1 answer
114 views

Abstracting common functionality for REST and CLI

I have made an application that deals with collections of images. Currently it has a REST api to add/remove images, create/clear/delete collections and a worker that can automatically fetch images ...
alexk745's user avatar
-1 votes
1 answer
2k views

Resful name API for multiple key objects

We are implementing an API and we want to follow best practices for naming the endpoints. However, during the design, we have found a challenge. We have some objects where the key to the objects is a ...
ypriverol's user avatar
  • 111
1 vote
0 answers
2k views

dealing with too many DTO / Java

We are building an pseudo-rest API (because no body cares/funds for a full blown rest API for internal use - which is OK). So we have elements of Rest API (links for resources, API naming conventions ...
Dexters's user avatar
  • 135
8 votes
4 answers
2k views

Advantages of HATEOAS based RESTful service

There is a scenario, where we have two commercial applications that are so called REST based(java) but not HATEOAS compliant. Development activity is out-sourced to vendor Development phase of ...
mohet's user avatar
  • 89
3 votes
4 answers
7k views

Check if resource exists before inserting to the database or wait until the DAO throw the Exception?

I have two paths: /students /students/{id}/addresses ...with the following behavior: POST to /students - 201 Created (if successfully created the Student) POST to /students/{id}/addresses - 201 ...
Matheus's user avatar
  • 173
0 votes
1 answer
160 views

Add the database layer to your application with a service or include it directly?

I am planning to set up a new Web-application that contains the following things: I want to use JavaEE with JSF for the Frontend & Backend combined with git-hooks to deploy them onto my server. ...
Rüdiger's user avatar
  • 103
1 vote
2 answers
984 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 ...
J Fabian Meier's user avatar
2 votes
1 answer
839 views

Microservices loose coupling using distributed business logic or centralized?

How do we achieve loose coupling in the below scenario: N microservices (let's call them Callers) needs a logic or business( let's call it Worker) to be executed with different contracts. Although ...
Vishal nigam's user avatar
4 votes
2 answers
295 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 ...
Claudiga's user avatar
  • 149
2 votes
4 answers
8k 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 ...
VedantK's user avatar
  • 129
1 vote
0 answers
827 views

How to make rest api end points in swagger UI pre authenticated in Spring BOOT [closed]

I have written a spring boot rest API application with OAuth.I have integrated swagger UI for API documentation. I want the API endpoints on swagger UI to be accessible without an access token. This ...
Curious's user avatar
  • 11
2 votes
2 answers
2k views

Returning JPA Entities in Rest Api's?

Recently Ive seen so many devs working with the stack Spring/JPA and returning all these JPA entities on their rest controllers. In my opinion it's a BAD PRACTICE for several reason such: ...
carlos.hager's user avatar
8 votes
1 answer
7k views

Implementing a REST API in a Clean Architecture

I have been implementing a proof of concept application using Uncle Bob's Clean Architecture and I have run into a bit of a problem. Uncle Bob's architecture calls for the explicit separation of ...
Carlos's user avatar
  • 83
6 votes
2 answers
3k views

How to deal with file events with microservice that exposes a REST API

A bit of context. The company where I work is starting to transition to a modular architecture (something similar to microservices) for our main product, currently monolithic. The first step is to ...
GalacticDessert's user avatar
0 votes
0 answers
466 views

Testing REST API with nested object creation and endpoint transactionality

I'm building a location based REST API using Spring Boot, and I have run into a bit of a testing philosophy question. I have an object called Location that, among other things, requires a Google ...
sunrize920's user avatar
2 votes
2 answers
6k views

Maintaining stateful information in REST API

I am developing a REST API which accepts JSON using Spring Boot. I use Spring Security for authentication. I have a use case where I have two services, one to test connection to a 3rd party system and ...
Venkatesh's user avatar
3 votes
3 answers
3k views

REST Api - Check if Action is allowed for entity

I'm asking this question for a colleague since he doesn't have enough reputation to post images in a question During our normal development we found a deficit in our REST Api. We display entities in ...
Nico's user avatar
  • 139