Apicat Docs
  1. Using scripts
Apicat Docs
  • What is Apicat?
  • Send requests
    • Create requests
      • Request basics
      • Parameters and body
      • Request headers
      • Request settings
      • Dynamic values
      • HTTP/2
      • SOAP/WebService
    • Authentication and authorization
      • Overview
      • CA and client certificates
      • Authorization types supported by Apidog
      • Digest Auth
      • OAuth 1.0
      • OAuth 2.0
      • Hawk Authentication
      • Kerberos
      • NTLM
      • Akamai EdgeGrid
    • Response and cookies
      • Overview
      • API response in Apidog
      • Create and send cookies
      • Debug requests
    • Dynamic values Modules
      • Airline
      • Animal
      • Color
      • Commerce
      • Company
      • Database
      • Datatype
      • Date
      • Finance
      • Food
      • Git
      • Hacker
      • Helpers
      • Image
      • Internet
      • Location
      • Lorem
      • Music
      • Number
      • Person
      • Phone
      • Science
      • String
      • System
      • Vehicle
      • Word
  • Environments & variables
    • Overview
    • Using variables
    • Environments & services
  • Pre/Post processors
    • Overview
    • Assertion
    • Extract variable
    • Wait
    • Database operations
      • Overview
      • MySQL
      • MongoDB
      • Redis
      • Oracle Client
    • Using scripts
      • Overview
      • Pre processor scripts
      • Post processor scripts
      • Public scripts
      • Postman scripts reference
      • Calling other programming languages
      • Using JS libraries
      • Visualizing responses
      • Script examples
        • Assertion scripts
        • Using variables in scripts
        • Using scripts to modify request messages
        • Other examples
  • Best practices
    • How to handle API signatures
    • How to access OAuth 2.0 protected APIs
    • Apidog collaboration workflow
    • Managing authentication state in Apidog
  • Account & preferences
    • Account settings
    • Generate OpenAPI access token
    • Language settings
    • Hot keys
    • Network proxy configuration
    • Data backup
    • Updating Apidog
    • Deleting account
    • Experimental Features
  • References
    • API-Design First Approach
    • Apidog OpenAPI/Swagger Specificaiton Extensions
    • JSONPath
    • XPath
    • Regular Expressions
    • JSON Schema
    • CSV File Format
    • Install Java Environment
    • Runner deployment environment
    • Apidog flavored Markdown
  1. Using scripts

Visualizing responses

Apidog offers a programmable approach to visualize response data, allowing you to present response information in an easily understandable manner. This will enable team members to gain a clearer understanding of the current API documentation.

1. Adding custom script#

In Apidog, you can add custom scripts in pre-operation or post-operation.

2. Invocation method#

In the custom script, use the pm.visualizer.set() function to display the visualized result in the Visualize tab of the response body.

Code example#

In the post-operation, you can use a custom script to extract links from the response and generate base64 images.

pm.visualizer.set()#

This method accepts 3 parameters.
1.
The template parameter (required):
template is a required parameter, The first parameter is the HTML template string received by Handlebars , which will eventually be rendered under <body>.You can write <link> in template to load external css stylesheets, or use <script> to load third-party libraries.
2.
The data parameter (optional):
Select the parameter data to receive an object that is used to replace the template string variable of Handlebars.
3.
The options parameter (optional):
It is the same as the options parameter received by the options method. It is used to configure how Handlebars compiles the template string passed in the first parameter.

pm.getData(cb: (err, data) => void)#

The parameter received by this method is a function that allows you to get the data of the second parameter you passed in the template string passed in pm.visualizer.set().
1.
error error message
2.
The data passed in by data through the second parameter pm.visualizer.set()
You cannot call Worker and indexedDB in the window object in the template string.
Modified at 2025-06-25 07:57:16
Previous
Using JS libraries
Next
Assertion scripts
Built with