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

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

  1. Open Postman, click Import to import the decompressed Postman Collection folder.

  2. 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.

    添加环境变量.png

  3. 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.

    环境变量.png

    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

  1. Select IM > Messaging ID > Create Messaging ID on the left side of Postman, and click Send.

  2. Check the response below. If code is not 200, troubleshoot the issue according to desc in the response.

    注册账号.png

Send a message

  1. 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.

    发送消息.png

  2. Check the response below. If code is not 200, troubleshoot the issue according to desc in the response.

    发送失败.png

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.

语言选择.png

Was this page helpful?
Yes
No
  • Prerequisites
  • Step 1: Import and configure environment variables
  • Step 2: Start debugging
  • Register a Messaging account
  • Send a message
  • Generate a target programming language