Testing APIs with Postman
Update time: 2023/10/23 07:50:29
Postman is an API development and testing tool that provides an intuitive visual interface. You can send HTTP requests (such as GET, POST, PUT, DELETE, etc.) and view the response. It also provides advanced features such as environment variables, multiple languages, and predefined scripts. You can debug and manage your APIs using Postman.
This document provides guidance on utilizing Postman for debugging the Messaging RESTful APIs. We offer a convenient Postman Collection that you can download and use to facilitate debugging and testing.
Prerequisites
- You have installed Postman.
- You have download and uncompressed Postman Collection.
- You have have created a project in the CommsEase console and get the AppKey of your project.
- You have understood API calling methods.
Please note that the provided Collection is intended solely for debugging purposes and does not encompass all server-side APIs. It serves as a useful resource for testing and diagnosing issues but may not cover the entire available server-side APIs.
Step 1: Import and configure environment variables
-
Open Postman, click Import to import the decompressed Postman Collection folder.
-
Once the import is successfully completed, click the eye icon located in the upper right corner. Click Add under the Globals section to incorporate global variables into your environment.
-
Add two global variables, AppKey and AppSecret. Specify the CURRENT VALUE fields with the respective AppKey and AppSecret for your application acquired from the CommsEase console.
Click Save to preserve the configuration settings. In subsequent requests, the template will autonomously compute and generate the authentication parameters—Nonce, CurTime, and CheckSum—dynamically, utilizing the provided AppKey and AppSecret.
Step 2: Start debugging
Use Register a Messaging account and Send a message as examples to illustrate how to utilize Postman for debugging RESTful APIs.
Register a Messaging account
-
Select IM > Messaging ID > Create Messaging ID on the left side of Postman, and click Send.
-
Check the response below. If
code
is not 200, troubleshoot the issue according todesc
in the response.
Send a message
-
Select IM > Messaging > Send a text message in the left pane of Postman and click Body.
By default, the body data format is x-www-form-urlencoded. You should provide values for all keys, and note that the selected keys are required. For more information about parameters, see request parameters.
-
Check the response below. If
code
is not 200, troubleshoot the issue according todesc
in the response.
Generate a target programming language
Click the code icon on the right side of Postman and select the coding language you need to generate sample code.