A project is usually developed by multiple partners working together. The interdependency among them may in turn restrict each of them during the process, and mutual misunderstanding may influence the development progress or even delay the project schedule. Therefore, Mock is generally used to simulate the return results established early in the project development cycle, so as to reduce understanding deviation and improve the development efficiency.
API Gateway supports simple configuration in Mock mode.
Click API Edition > Basic Backend Definitions to configure the Mock.
Select the Mock mode
You can select Use Mock or Do not Use Mock. If you select Use Mock, the system will prompt you to confirm the selection.
Enter the Mock return result
You can enter the actual return result in the Mock return result field. Currently, the system supports Mock return results in JSON, XML or file format. For example:
"title": " Mock test for API Gateway",
Save the Mock configuration and release it to the test or online environment for test or to the API debugging page for debugging based on your actual needs.
You can initiate an API call on the API debugging page to test the setting result:
It means the Mock is successfully set.
To remove a Mock, change the selection to Do not Use Mock in the first image. The value of the Mock return result is not removed and you can use the value for the next Mock setting. You need to release the change. A change takes effect only after being released.