Search requests with multiple search values

(related: Fetching records matching multiple joined attributes) If Spring Data doesn't allow GET requests to have a body (and it's considered bad practice anyway) curl -X 'GET' \ 'http://localhost:8080/api/user' \ -H 'accept: */*' \ -H 'Content-Type: application/json' \ -d '{ "email": "steve@yahoo.com" }' TypeError: Failed to execute 'fetch' on 'Window': Request with GET/HEAD method cannot have body. @GetMapping public ResponseEntity findUsers(@RequestBody FindUserRequestDto userRequestDto) { List userResponseDtos = userService.find(userRequestDto); return ResponseEntity.ok(userResponseDtos); } import lombok.Getter; import lombok.Setter; import java.time.LocalDate; @Getter @Setter public class FindUserRequestDto { private LocalDate dateOfBirth; private String phone; private String name; private String email; private int pageNumber; private int pageSize; } then how am I expected to pass all that data? Am I supposed to pass all those as request parameters? But it would make the controller method's parameter list bloated and ugly. In a production scenario, a DB entity can easily have dozens of attributes (even if they should be refactored away). Semantically, it's clearly not a POST. What am I expected to do in this case according to REST conventions? Were REST conventions ever formalized, to begin with?

May 24, 2025 - 15:20
 0

(related: Fetching records matching multiple joined attributes)

If Spring Data doesn't allow GET requests to have a body (and it's considered bad practice anyway)

curl -X 'GET' \
  'http://localhost:8080/api/user' \
  -H 'accept: */*' \
  -H 'Content-Type: application/json' \
  -d '{
  "email": "steve@yahoo.com"
}'
TypeError: Failed to execute 'fetch' on 'Window': Request with GET/HEAD method cannot have body.
    @GetMapping
    public ResponseEntity> findUsers(@RequestBody FindUserRequestDto userRequestDto) {
        List userResponseDtos = userService.find(userRequestDto);
        return ResponseEntity.ok(userResponseDtos);
    }
import lombok.Getter;
import lombok.Setter;

import java.time.LocalDate;

@Getter
@Setter
public class FindUserRequestDto {

    private LocalDate dateOfBirth;
    private String phone;
    private String name;
    private String email;
    private int pageNumber;
    private int pageSize;
}

then how am I expected to pass all that data? Am I supposed to pass all those as request parameters? But it would make the controller method's parameter list bloated and ugly. In a production scenario, a DB entity can easily have dozens of attributes (even if they should be refactored away).

Semantically, it's clearly not a POST.

What am I expected to do in this case according to REST conventions? Were REST conventions ever formalized, to begin with?