Good morning, I need to make a query via REST where multiple IDs will be sent for example (ID: 1, ID: 2, ID: 3, etc).
To search only for an ID I use findById(codigo)
, but I do not know how to use multiple data.
As I'm using RESTFull, how would the URI be separated by multiple data?
How would my appeal be?
Today I do this (for an ID)
@GetMapping("/{id}")
public ResponseEntity<OBJ> buscarPeloCodigo(@PathVariable Long codigo) {
Optional<OBj> obj = pessoaRepository.findById(codigo);
return obj.isPresent() ? ResponseEntity.ok(obj.get()) : ResponseEntity.notFound().build();
}
and the URI: localhost: 8080 / data / 1