I have encountered an issue.
I need to pass an array of ids that looks like: [1,2,3,4]
from my frontend with axios to my spring boot mvc controller.
I want to retrieve the array from @RequestBody
in my controller.
How would I do it?
As already mentioned, I will post my code and what I have so far.
In my vue component, my axis call:
axios.put('{{ myUrl }}', {
genreIds: this.form.selectedGenres
})
In my mvc controller, my method:
@PutMapping("/url")
Song myMethod(
@PathVariable Long songId,
@RequestBody Long[] genreIds
) {
System.out.println(genreIds);
//My other code
}
And all I am getting is a bad request status 400
from my Server