Postman + JSON + SpringMVC Test Batch Add Example

POSTMAN Tool Configuration and Data Preparation:

1) Enter the interface address of the IP address and port number in the address bar;

2) in Headers Add parameter content-type = Application / JSON;

Tests have been used as an example: the corresponding configuration diagram is as follows:


3) Click on the Body column and select RAW, then enter the data set to transfer and add in the corresponding Text area;

These examples have two data bit, as shown below:

postman+json+springmvc测试批量添加实例 Where each data object corresponds to a database record to be saved, a Java object;

At this point, the configuration of Postman is completed, as long as you click The Send button triggers the sending event to send data to the backend interface.

Server interface configuration: Springmvc has been explained:

The Controller class object is added to solve the same other ordinary controller objects;

@RestController @ requestmapping (“/ room-call”) Public class roomController {/ ** * At the same time, add multiple instant suggested interfaces, and the parameters receive it to be tested. * * @Param RoomCallModels To store instant suggested collection * @return store success * / @ requestMApping (value = “/ add-all”, method = Public JSonResult AddallroomCall (@RequestBody List) (@RequestBody List) PUBLIC JSONRESULT ADDALLROOMCALL (@RequestBody List) roomCallModels) {// short determination of reception parameters, preventing the null pointer if (CollectionUtils.isEmpty (roomCallModels)) {return CommonError.PARAM_IS_NULL.toJSONResult ( “even if the proposed data”);} for (RoomCallModel roomCallModel: roomCallModels) { // Operation acceptable object collection, in turn, complete the specified service;}}
At this time, the POSTMAN-based transmission data set test is completed, where the RoomCallModel object is Receive data objects, the object to be entered, where postman transmits the attribute in each of the data in each of the entity objects.
The above Postman + JSON + SpringMVC Test Batch Add instance is the full content of Xiaobian sharing to everyone, I hope I can give you a reference, I hope everyone will support Tumi Cloud.

© Copyright Notice
Just support it if you like
comment Grab the couch

Please log in to comment