Bidisha
Bidisha

Reputation: 297

Bad Request 400 -@RequestBody

I am trying to send JSON :

{"source": "CED:100973626887874,CED:77148046400112,CED:222222222222201"}` 

and my Controller is as below:

@RequestMapping(value = "/multipleMember/list", method =RequestMethod.POST)
@ResponseBody
public List<MemberDetail> getMultipleMemberList(
        @RequestBody String memberList) {
    return memberServiceDelegate.getMultipleMemberList(memberList);
}

But I am getting bad request 400 : The request sent by the client was syntactically incorrect

Upvotes: 0

Views: 1564

Answers (2)

dom farr
dom farr

Reputation: 4181

perhaps your json object will need an object named memberList

{"memberList": "CED:100973626887874,CED:77148046400112,CED:222222222222201"}

Upvotes: 1

acolchagoff
acolchagoff

Reputation: 1978

I believe you need to wrap your json with { } in order to indicate it is an object.

{
"source": "CED:100973626887874,CED:77148046400112,CED:222222222222201" 
}

Upvotes: 0

Related Questions