I've been searching around here for a solution , but I found nothing useful for my case.
My Dao needs a String[]
and a single String
, so I did this:
@RequestMapping(value = "/add", method = RequestMethod.POST, consumes = { "application/json" })
public void newRent(@RequestBody String[] isbn,String username) {
rentService.newRent(isbn, username);
}
Now, I'm trying to do a POST
from Postman calling the mapped link, but I keep getting method not allowed (405
).
I tried a lot, this looks the best ways to do it, but still doesn't work.
[
{ { "isbn":"123"},{"isbn":"1234"},
{ "username" : "zappa"}
]
or
{
"isbn": ["123", "1234"],
"username": "zappa"
}
Am I missing something? cant figure it out!