In the development process of the project, it is usually used path
to distinguish different business data. However, for some development projects (such as some e-commerce API documents), the URL of the interface request remains unchanged, and is generally distinguished by parameters in Query or Header. If there are a large number of interfaces that need to specify Query, then uniform settings can be made during the interface testing process. Such business requirements can be fulfilled through the unique identifier of the interface of Apifox . Please refer to the following for specific operations.
Set the unique identifier of the interface
Interfaces uniquely identify settings defined in Apifox as目录
hierarchies. That is to say, when you need to define the unique identifier of an interface, you need to 父级目录
set it in the interface. According to your project requirements,目录设置
select the unique identification parameter you need under the option, and then click Save to take effect for all interfaces in this directory.
For example: the API interface of a certain module in a project , the business data returned in the interface is distinguished by a query parameter called action, so we
Query 参数
define it by following接口唯一标识
.
As shown in the figure below, after 接口唯一标识
selecting as in the figure Query 参数
below, enter the corresponding parameter name in the input box on the right, and click Save to complete the setting.
Fill in the corresponding unique identifier parameter value
After setting the unique identifier of the interface, select an interface in this directory, and Apifoxaction
will prompt you to enter the value of the parameter name , and you can initiate the request after filling it out.
If you need to call other interfaces in this directory, the operation method is the same as the above description. Apifox will automatically add query parameters for you, eliminating the tedious steps of manually adding one by one, making your work more efficient!
Summarize
The path and method of the interface are the same, and only the query parameter is used to distinguish the interface of business data. The unique identifier of the interface of Apifox can meet your application requirements. Want to learn more about related knowledge, such as interface import, Mock data and automated testing functions.