I need to send list of Long objects from Angular to Rest controller in Spring boot :
@PostMapping("/accept-friends")
public ResponseEntity<Void> acceptFriendRequests(@RequestBody List<Long> friendRequestsIds)
Is this possible ?
I need to send list of Long objects from Angular to Rest controller in Spring boot :
@PostMapping("/accept-friends")
public ResponseEntity<Void> acceptFriendRequests(@RequestBody List<Long> friendRequestsIds)
Is this possible ?
Yes this is possible and will work fine.
@PostMapping("/accept-friends")
public ResponseEntity<?> acceptFriendRequests(@RequestBody List<Long> friendRequestsIds) {
return new ResponseEntity<>(HttpStatus.OK)
}
Here you have code in Angular 6:
getData(friendRequestsIds: number[]) {
return this.http.post<Question>('/accept-friends', friendRequestsIds);
}
You can use it like this:
@PostMapping("/listData")
public ResponseEntity<Object> listData(@RequestBody List<?> completeList) {
return new ResponseEntity<Object>(HttpStatus.OK)
}
As I know, you can't keep the ResponseEntity<void>
I hope this will help.