【发布时间】:2016-11-18 13:48:07
【问题描述】:
我有一个post方法如下
@RequestMapping(value = "/user/profile", method = RequestMethod.POST)
@ResponseBody
public ResponseEntity<?> updateProfile(@RequestParam("userId") long userId,
@RequestParam(value = "profilePicId", required = false) Long profilePicId,
@RequestParam("payload") String payload) throws IOException {
//some logic
}
我想通过邮递员打,这是我的请求网址
{{host}}/abc/api/someVersion/user/profile/?userId=12345
其中 userId 是请求参数,json 作为另一个参数(即有效负载)
{
"showInitials": true,
"personalQuote": "",
"wooAlbum": [{
"photoStatus": "APPROVED",
"objectId": "1509974142644942",
"imageOrder": 0,
"srcBig": "http:\/\/amazonaws.com\/uploadedPhoto\/1472267515843.jpeg",
"profilePic": true
}, {
"photoStatus": "APPROVED",
"objectId": "1509970579311965",
"imageOrder": 1,
"srcBig": "http:\/\/amazonaws.com\/wooPictures\/1234.jpg",
"profilePic": false
}],
"degree": [{
"isSelected": 1,
"tagId": 1,
"tagsDtoType": "NONE",
"name": "No Info (update your linked account)"
}],
"company": [{
"isSelected": 0,
"tagId": 1,
"tagsDtoType": "NONE",
"name": "No Info (update your linked account)"
}],
"college": [{
"isSelected": 1,
"tagId": 169421983068086,
"tagsDtoType": "USER_EDUCATION",
"name": "MDU, Rohtak"
}],
"religion": [],
"location": " Delhi",
"showHeightType": "INCHES",
"ethnicity": [],
"isMutualFriendVisible": false,
"tagsDtos": [{
"tagId": "12",
"name": "Tennis",
"tagsDtoType": "WOO_TAG"
}, {
"tagId": "16",
"name": "Marathons Runner",
"tagsDtoType": "WOO_TAG"
}, {
"tagId": "19",
"name": "Basket ball",
"tagsDtoType": "WOO_TAG"
}],
"designation": [{
"isSelected": 0,
"tagId": 1,
"tagsDtoType": "NONE",
"name": "No Info (update your linked account)"
}]}
我在正文的原始部分下发布了它(json),而格式是 application/json。还在标题部分下输入了内容类型和字符集值。
点击发送按钮后,我收到 400(Bad Request) 作为响应。
谁能建议如何为这些参数创建 url?
【问题讨论】:
标签: web-services rest jax-rs postman spring-restcontroller