All Questions
112 questions
2
votes
0
answers
123
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 = "...
-1
votes
2
answers
161
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": &...
-1
votes
2
answers
393
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 ...
2
votes
3
answers
922
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 ...
1
vote
5
answers
931
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;...
-2
votes
1
answer
94
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 ...
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 ...
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")
...
0
votes
3
answers
180
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 ...
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 ...
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 ...
9
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 ...
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 ...
1
vote
1
answer
916
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 ...
3
votes
2
answers
207
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 ...