Apidog Docs
πŸ‡ΊπŸ‡Έ English
  • πŸ‡ΊπŸ‡Έ English
  • πŸ‡―πŸ‡΅ ζ—₯本θͺž
HomeLearning CenterSupport CenterAPI References
HomeLearning CenterSupport CenterAPI References
Discord Community
Slack Community
X / Twitter
πŸ‡ΊπŸ‡Έ English
  • πŸ‡ΊπŸ‡Έ English
  • πŸ‡―πŸ‡΅ ζ—₯本θͺž
  1. Database operations
  • Apidog Learning Center
  • Get started
    • Introduce Apidog
    • Basic concepts in Apidog
    • Navigating Apidog
    • Quick Start
      • Overview
      • Specify a new endpoint
      • Make a request to the endpoint
      • Add an assertion
      • Create a test scenario
      • Share your API documentation
      • Explore more
      • Send a request and save as an endpoint
    • Migration
      • Overview
      • Manual import
      • Scheduled import
      • Import options
      • Export data
      • Import from...
        • Import from Postman
        • Import OpenAPI (Swagger) spec
        • Import cURL
        • Import Markdowns
        • Import from Insomnia
        • Import from apiDoc
        • Import .har file
        • Import WSDL
  • Design APIs
    • Overview
    • Create a new API project
    • Endpoint basics
    • Components
    • Common fields
    • Global parameters
    • Endpoint change history
    • Batch endpoint management
    • Configure multiple request body examples
    • Schemas
      • Generate Schemas from JSON etc.
      • Build a schema
      • Overview
      • Create a new schema
    • Security schemes
      • Overview
      • Create a security scheme
      • Use the security scheme
      • Security scheme in online documentation
    • Advanced features
      • Custom endpoint fields
      • Import endpoints as test steps
      • Endpoint status
      • Appearance of parameter lists
      • Endpoint unique idenfication
  • Develop and Debug APIs
    • Overview
    • Generate requests
    • Send requests
    • Endpoint cases
    • Dynamic values
    • Validate responses
    • Design-first Mode & Request-first Mode
    • Generate code
    • Environments & variables
      • Overview
      • Using variables
      • Environments & services
    • Vault secrets
      • Overview
      • HashiCorp Vault
      • Azure Key Vault
      • AWS Secrets Manager
    • Pre/Post processors
      • Overview
      • Assertion
      • Extract variable
      • Wait
      • Database operations
        • Overview
        • MongoDB
        • Redis
        • Oracle Client
      • Using scripts
        • Overview
        • Postman scripts reference
        • Pre processor scripts
        • Post processor scripts
        • Public scripts
        • 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
    • Dynamic values Modules
  • Mock API data
    • Overview
    • Smart mock
    • Custom mock
    • Mock priority sequence
    • Mock scripts
    • Cloud mock
    • Self-hosted runner mock
    • Mock language (Locales)
  • Automated tests
    • Overview
    • Test reports
    • Test scenarios
      • Create a test scenario
      • Pass data between requests
      • Flow control conditions
      • Import endpoints/endpoint cases from other projects
      • Sync data from endpoints/endpoint cases
      • Export test scenarios
    • Run test scenarios
      • Run a test scenario
      • Data-driven testing
      • Run test scenarios in batch
      • Scheduled tasks
      • Manage the runtime environment of APIs from other projects
    • Test APIs
      • Integration testing
      • Performance testing
      • End-to-end testing
      • Regression testing
    • Apidog CLI
      • Overview
      • Installing and running Apidog CLI
      • Apidog CLI Options
    • CI/CD
      • Overview
      • Integrate with Jenkins
      • Integration with Gitlab
  • Publish API Docs
    • Overview
    • API Technologies Supported
    • Quick share
    • View the API documentation
    • Publish docs sites
    • Folder tree settings
    • Custom layouts
    • Visibility settings
    • Endpoint SEO settings
    • Custom domain
    • Embedding values in document URLs
    • Documentation Search
    • Integrating Google Analytics with Doc Sites
    • CORS Proxy
    • API Versions
      • Overview
      • Create API versions
      • Publish API versions
      • Share endpoints with API versions
  • Send requests
    • Overview
    • gRPC
    • Use request proxy agents for debugging
    • SOAP/WebService
    • GraphQL
    • WebSocket
    • Socket.IO
    • SSE debugging
    • Create requests
      • Request History
      • Request basics
      • Parameters and body
      • Request headers
      • Request settings
      • HTTP/2
    • 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
      • Save the request as an endpoint
  • Branches
    • Overview
    • Create a new sprint branch
    • Test APIs in a branch
    • Design API in a branch
    • Merge sprint branches
    • Manage sprint branches
  • Apidog MCP Server
    • Overview
    • Conntect API Specification within Apidog Project to AI via Apidog MCP Server
    • Conntect Online API Documentation Published by Apidog to AI via Apidog MCP Server
    • Conntect OpenAPI Files to AI via Apidog MCP Server
  • Best practices
    • How to handle API signatures
    • How to access OAuth 2.0 protected APIs
    • Apidog collaboration workflow
    • Managing authentication state in Apidog
  • Administration
    • Onboarding Checklist
      • Basic Concepts
      • Onboarding Guide
    • Managing Teams
      • Managing Teams
      • Managing Team Members
      • Member Roles & Permission Settings
      • Team Activities
      • Team Resources
        • General Runner
        • Team Variables
        • Request Proxy Agent
      • Real-time Collaborations
        • Team Collaboration
    • Managing Projects
      • Managing Projects
      • Managing Project Members
      • Notification Settings
      • Project Resources
        • Database Connection
    • Managing Organizations
      • Single Sign-On (SSO)
        • SSO Overview
        • Configure Microsoft Entra ID
        • Configure Okta
        • Configure SSO for an Organization
        • Managing user accounts
        • Mapping Groups to Teams
      • SCIM Provisioning
        • Intro to SCIM Provisioning
        • Microsoft Entra ID
        • Okta
      • Organization Resources
        • Self-hosted Runner
  • Billing
    • Overview
    • Credits
    • Unable to use credit cards?
    • Managing subscriptions
    • Upgrade plan
  • Add-ons
    • API Hub
    • Apidog Intellij IDEA plugin
    • Browser Extension
      • Chrome
      • Microsoft Edge
    • Request Proxy
      • Request proxy in Apidog web
      • Request proxy in shared docs
      • Request proxy in Apidog client
  • Account & preferences
    • Language settings
    • Data backup
    • Network proxy configuration
    • Hot keys
    • Updating Apidog
    • Generate OpenAPI access token
    • Deleting account
    • Account settings
  • 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
  • Apidog Europe
    • Apidog Europe
  • Support Center
  1. Database operations

Database Operations in Apidog

Pre/post processors support adding databases. After selecting and connecting to a database, you can perform CRUD and more on the data tables. The results of these operations can be printed in the console or extracted as variables. These variables can then be used in various scenarios, such as parameters for other endpoint requests, assertions, custom scripts, and interacting with other databases.

Getting started#

Here are the steps to use database operations.
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
Hover over "Add PostProcessor" and select "Database operation".
3
Name the database operation and select a database connection.
4
Enter the SQL command. The command supports using {{variables}} within it.
For example, you can use SQL like this:
5
You have the option to extract the results of the SELECT query as variables. Set "Extract Result To Variable". JSONPath is supported.
The SELECT statement retrieves an array of results where each row represents an element in the array. For example, using the JSONPath $[0].uid would extract the value of the "uid" field from the first row of the results.
6
Click Send to execute the request. You can view the database operation's results in the Console.
Apidog supports standard SQL queries but does not accommodate complex SQL operations like stored procedures.

Database connections#

Apidog Free supports connections to the following types of databases:
MySQL
SQLServer(Supports versions above SQL Server 2014)
Oracle
PostgreSQL
After upgrading to the paid version, Apidog also supports connectivity to the following databases in addition:
Clickhouse
MongoDB
Redis
Connecting to an Oracle database in Apidog requires installing the Oracle Client separately.
To set up a database connection in Apidog, follow the steps:
1
Navigate to Settings - Database Connections.
image.png
2
Click on "New" at the top right to create a new database connection entry.
3
Choose the database type from the available options and provide the necessary connection details for the database, such as host, port, database name, username, and password.
4
Besides connecting to a database locally with a username and password, you can establish a more secure connection through an SSH tunnel for added protection of the data being transmitted.
5
Click Save,and you'll be able to select this connection in Post processors.
Apidog values your data security. Database address, port, username, password, and database name are only stored on the client side locally and are not synced to the cloud. Even within the same team, members do not sync their database connection information with each other, and each team member needs to manually set up their database.
MySQL Tips
Currently, the latest mysql modules do not fully support the caching_sha2_password encryption method of MySQL8, where caching_sha2_password is the default encryption method.
Please use the method that requires you to specify the mysql_native_password mode to change the MySQL account password, use another tool to connect to MySQL, and then run the following SQL to change the password of the corresponding account.
Please replace username and password above manually.

Using database operations in multiple environments#

When working with multiple environments such as testing and production environments, they often have different databases configured. If you are using database operations in your workflows, it implies that these operations need to switch along with the environment changes.
In such scenarios, you can configure multiple database connections under the "Database Connections" settings in Apidog. By setting up database connections for each environment, you can ensure that when switching between environments using the dropdown menu in the top right corner, the database queries will automatically be directed to the corresponding database connection associated with that environment.

Using NoSQL databases#

For operations on MongoDB, refer to MongoDB operations.
For operations on Redis, refer to Redis operations.

Using database operations in Apidog CLI#

Apidog supports executing test scenarios on any platform using the Command Line Interface (CLI). By utilizing the CLI, you can fetch test scenario configurations from the server in real-time and run them efficiently.
However, since database operations are locally stored, it means that the CLI cannot dynamically access your database configurations.
In such cases, you need to export your database operations as configuration files and place them on the machine where the CLI is being run. Learn more about Apidog CLI.

FAQ#

Q: Can I combine multiple SQL queries into a single database operation in Apidog?
A: Each database operation in Apidog can only execute one SQL query. If you have multiple SQL queries to run, they need to be divided into separate database operations for execution.
Modified atΒ 2025-03-17 04:26:11
Previous
Wait
Next
MongoDB
Built with