Debug using Postman
This document is no longer updated. It is recommended to use How to Debug Server API Online for debugging.
This document describes how to use Postman to debug server APIs.
Postman is an API Debugging tool that allows developers to conveniently and intuitively debug server APIs in a graphical interface.
To facilitate developers in debugging cloud communication product server APIs, ZEGO provides a corresponding Postman Collection with predefined request parameters for each interface. Developers only need to modify the parameter values after importing.
Prerequisites
- Have downloaded and installed Postman.
- Have downloaded and extracted the Collection for Cloud Communication Product Server API.
- Have logged in to the ZEGO Console to obtain the AppId and ServerSecret required for calling the interface.
- Postman client interfaces vary slightly across different platforms. This document uses Postman on macOS as an example.
- The Collection provided in this document is for debugging only and does not include all server APIs.
Import and configure Collection
- Click "Import" to import both files obtained from extracting the collection together.

- Set the environment to "RTC".

- Open the "RTC" environment, set the AppId and ServerSecret obtained in the Prerequisites to the corresponding "CURRENT VALUE" of the environment variables, and then save.

If the AppId is for a test environment (see the parameter description for IsTest in "Common Parameters" under Calling Method for details), you also need to modify the value of "IsTest" in the environment variables (the last parameter in the figure above) to "true".
Debug interfaces
This section uses 3 interfaces as examples to introduce how to use Postman to debug server APIs.
The ZEGO-provided collection implements automatic filling of common parameters through environment variables and pre-scripts. The pre-scripts can be viewed at the location shown in the figure below. Developers can refer to them when developing the server.

Send broadcast message
This API is used to send broadcast messages in a Room. Before calling this interface, developers need to log in to the Room first.
Developers can refer to Run Sample Source Code to run the Demo to log in to the Room, or refer to Quick Start to develop their own application to log in to the Room.
- Select "SendBroadcastMessage" in Collections, and modify the parameter values in Param according to the parameter description in Send broadcast message. Parameter values wrapped in double braces are environment variables and do not need to be manually modified.

- Click "Send" and view the response content below. If the Error code in the response message is not 0, please modify the request according to the error description in the response message and send again.

Kick User out of Room
This API is used to kick a specified User out of the Room. All current Publish stream and Play stream of that User will be stopped. Before calling this interface, developers need to log in to the Room first.
Developers can refer to Run Sample Source Code to run the Demo to log in to the Room, or refer to Quick Start to develop their own application to log in to the Room.
- Select "KickoutUser" in Collections, and modify the parameter values in Param according to the parameter description in Kick User out of Room. UserId[] is the User ID to be kicked out of the Room. You can carry one or more, supporting up to 5 User IDs. For specific meanings, please refer to the parameter description.

- Click "Send" and view the response content below. If the Error code in the response message is not 0, please modify the request according to the error description in the response message and send again.

Start Stream Mixing
This API is used to start/update Stream Mixing tasks.
Before using this interface for the first time, you need to contact ZEGOCLOUD Technical Support to enable it.
- Select "StartMix" in Collections, and modify the parameter values in Body according to the parameter description in Start Stream Mixing.

- Click "Send" and view the response content below. If the Error code in the response message is not 0, please modify the request according to the error description in the response message and send again.

