The difference between swagger and postman passing parameters

The swagger3 front-end transfer parameters need to have double quotes "id": "590896404591554560", but the postman front-end transfer parameters do not need double quotes "id": 590896404591554560, why?

Both Swagger and Postman are commonly used API testing tools, which can be used to send HTTP requests from the front end to the back end, pass parameters, and test the function and correctness of the API interface. The following is a detailed description of the differences between Swagger3 and Postman in terms of passing parameters at the front end:

Parameter passing method: Both Swagger3 and Postman support passing parameters in HTTP requests, but their passing methods are slightly different. In Swagger3, parameters can be passed in various ways such as form, JSON, XML, etc., while in Postman, it is more inclined to use JSON format to pass parameters.

Parameter format: Swagger3 has strict requirements on the format of request parameters, and needs to follow the standard JSON format.Parameter names and parameter values ​​must be enclosed in double quotes, separated by "," between attributes. The difference is that Postman's parameter format is more arbitrary, you can use JSON format, XML format, form format, etc., and you can freely define the parameter name and parameter value type.

Parameter editing: In Swagger3, editing request parameters needs to be troublesome. It needs to be edited through parameter templates, parameter definitions, etc., which is relatively complicated in function. In Postman, editing parameters is relatively simple, and parameters can be added directly on the interface through key-value pairs.

Parameter passing method: Swagger3 and Postman also have slightly different parameter passing methods. In Swagger3, parameters can be placed directly in the request body, or in the request header or URL, while in Postman, the parameters are placed in the request body by default. The parameter passing method can be flexibly configured according to actual needs.

In general, both Swagger3 and Postman are powerful API testing tools, and there are some differences in the details of passing parameters from the front end to the back end. It is necessary to select the appropriate tool according to different situations, or to use two tools to complement testing and development.

Guess you like

Origin blog.csdn.net/l_010/article/details/131287231