API mocking lets you simulate an API call and return a specific response. To use this feature, navigate to the Manage gateway > Function Switch page and enable the API Mock switch.
Procedure
Configure API mocking as follows:
Choose the Manage APIs tab> More > API Mock in the Operation column of the API list.
On the Mock Configuration page, configure the following parameters:
API Mock: Enable the API Mock switch.
Hit Rule: Only the Percentage rule is currently supported.
Rule Configuration: A percentage value from 0 to 100.
Mock Data: Enter the mocked API response data. The data must be in the following format:
{ "resultStatus": 1000, "tips": "ok", "result": "==Enter the mocked business data here==" }Where:
resultStatusis the response code. For more information, see Gateway result codes.tipsis the response message.resultis the custom response data in JSON format.
Click Submit.