Mock the returned value of a certain API to provide specific response. To use API Mock function, go to the Manage gateway > Function switch page to turn API Mock on.
Procedure
The procedure of configuring API Mock is as follows:
Under the Manage APIs tab, click More > API Mock right to a specific API in the API list.
On Mock configuration page, configure the following parameters:
API Mock: Enable or disable the API Mock.
Hit rule: Currently, API Mock supports Percentage rule.
Rule configuration: Specific percentage value, the value range is 0 ~ 100.
Mock data: Mock API response data.
The Mock data is in the following format:
{ "resultStatus": 1000, "tips": "ok", "result": "==Enter the Mock business data here ==" }
In the above codes:
resultStatus
refers to the returned result code. For the concrete meaning, see Gateway result codes.tips
refers to the response tip.result
refers to the custom response data in JSON format.
Click Submit to enable API Mock.