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.
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:
"result": "==Enter the Mock business data here =="
In the above codes:
resultStatusrefers to the returned result code. For the concrete meaning, see Gateway result codes.
tipsrefers to the response tip.
resultrefers to the custom response data in JSON format.
Click Submit to enable API Mock.