Apicat Docs
  1. Pre/Post processors
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. Pre/Post processors

Extract variable

Apidog supports visually extracting values from the API response and saving them as variables.

Extract variables#

To get started to extract variables, follow these steps:
1
In the Run tab (Design-first Mode) or the Request tab (Request-first mode), navigate to Post Processors.
Design-first Mode
Request-first Mode
image.png
2
Enter the Variable Name and choose the Variable Scope.
Select the extraction source, such as Response JSON, Response XML, or Response Text, etc.
3
If the response is in JSON/XML format, you can utilize JSONPath/XPath syntax to parse a specific part of the Response JSON/XML and save it as the value of the variable.
image.png
4
After clicking "Send" to send the request, the variable extraction will be executed, and you can view the logs in the Console.
image.png

Extract variables from actual response#

To quickly extract variables from the actual response, hover over the response field(e.g., on endpoint response or test reports), and click onExtract variable.
image.png

Extract source#

Apidog supports extracting data from various data sources. Below are the different data sources from which data extraction is supported:
Response text: Supports extracting data using Regex expressions.
Response JSON: Supports extracting data using JsonPath expressions.
Response XML: Supports extracting data using XPath expressions.
Response Header: Extract from header name.
Response cookie: Extract from cookie name.
Time Consuming: Extract the time taken for request execution, providing insights into request response times and performance metrics for analysis and optimization purposes.

JSONPath extraction tool#

JSON is the most commonly used response data format, and JSONPath is a widely used syntax for data extraction within JSON structures. Apidog provides a visual JSONPath Extraction tool to simplify the process of crafting JSONPath expressions. Here is a guide on how to use this tool effectively:
1
Click on the icon located to the right of the JSONPath input box.
image.png
2
In the JSONPath Extraction tool that pops up, the left section displays the JSON response. You can input your JSONPath expression in the JSONPath Expression field at the top right. The results section at the bottom will dynamically extract the corresponding data based on your expression.
image.png
3
If your JSONPath expression includes wildcard characters (*) or similar elements that may result in extracting multiple values, the results will be enclosed within square brackets ([]). If you wish to extract a specific value and avoid the brackets, you can toggle the "Continue extracting" switch and specify the index of the value you want to extract.
Modified at 2025-06-25 07:57:16
Previous
Assertion
Next
Wait
Built with