Apidog

All-in-one Collaborative API Development Platform

API Design

API Documentation

API Debugging

API Mock

API Automated Testing

Sign up for free
Home / Tutorials / How to Bulk Add Parameters to the Body of API Requests in Apidog?

How to Bulk Add Parameters to the Body of API Requests in Apidog?

When designing APIs in Apidog, you may encounter situations requiring the addition of a large number of request parameters. In this article, we will explore various methods to bulk add request parameters.

When designing APIs in Apidog, you may encounter situations requiring the addition of a large number of request parameters. Imagine an endpoint that necessitates dozens or even hundreds of parameters. Adding each parameter individually in the "Edit" section can be cumbersome, time-consuming, and prone to errors.

Fortunately, Apidog offers ways to batch-add parameters, making the process smoother and more efficient.

Body params

In this article, we will explore various methods to bulk add request parameters. Let's dive into the details.

button

Method 1: Using the Bulk Edit Feature

When the body parameter type is form-data or x-www-form-urlencoded, you can utilize the "Bulk Edit" feature to add request parameters.

Access the Bulk Edit Function:

In the parameter list, locate the "Bulk Edit" button in the upper right corner. Clicking this button will open a text editing box where you can input parameters in bulk.

 Bulk Edit Feature

Input Parameters in CSV Format:

The parameters must be in CSV format. For example, for form-data parameters, the required format is:

Parameter Name, Type, Required, Example Value, Content-Type, Description

Each item separated by commas can be left blank if necessary. You can leverage AI tools to organize this data and minimize errors. Here’s an example:

email, string, false, user@gmail.com, text/plain, User's email address
password, string, false, ********, text/plain, User's password
Input Parameters in CSV Format

After entering the parameters, click the "OK" button to generate the corresponding request parameters.

Form data

Method 2: Generating Parameters from Existing Formats

When working with body parameter types such as JSON or XML, you can paste content directly in the specific format to generate parameters automatically.

Generating Parameters from Existing Formats

Use JSON to Bulk Add Parameters:

Click the "Generate from JSON" button in the parameter list, which opens a text editing box where you can paste or input the JSON object.

Comments in the JSON can be recognized as parameter descriptions. You can specify the override mode or naming conventions as required. Here’s an example:

{"region_id": "82","email": "b.wawjn@gmail.com", // User's email"sales_channel_id": "12","customer_id": "98","country_code": "70", // Country code"context": {"ip": "::1","user_agent": "Chrome"
    },// Other parameters...
}

You can preview the inputted JSON data before confirming.

Preview the inputted JSON data

After editing, click the “OK” button to generate the corresponding request parameters.

If the “Generate Automatically” switch is turned on, request examples are also generated.

Use XML to Bulk Add Parameters:

Similar to JSON, you can also paste your XML data into the editing box. Click the "OK" button to generate the relevant request parameters. Here’s an example:

Import from Database:

You also have the option to import parameters from a database by connecting and selecting the desired data tables. The field comments in the database can be used as descriptions or names.

Import from Database

Alternatively, you can input SQL DDL statements to generate parameters (currently only supports MySQL), like so:

CREATE TABLE 
carts
 (
  id int NOT NULL AUTO_INCREMENT,
  region_id varchar(10) DEFAULT NULL,
  email varchar(255) DEFAULT NULL,
  sales_channel_id varchar(10) DEFAULT NULL,
  customer_id varchar(10) DEFAULT NULL,
  country_code varchar(10) DEFAULT NULL,PRIMARY KEY (
id
)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
 Input SQL DDL

Method 3: Adding Common Parameters/Data Models

Apidog allows you to create and use predefined parameter templates, enabling reuse across similar APIs, notably through common parameters and data models.

Adding Common Parameters:

In the left navigation bar, select "Settings," then click "Common Parameters" to add parameters that you frequently use.

Adding Common Parameters

When you need to use a common parameter in the API, just click the parameter input box, and a selection panel will appear for you to choose your predefined parameters quickly.

Params
Tgas

Adding Schemas:

Find the "Schemas" option in the left navigation bar, click the "New Schemas" button, enter the model's name and description, then add fields and define each field’s type, example value, and description.

New Schemas

Schemas parameters can also be generated via JSON or JSON Schema, as mentioned in Method 2.

Generate from JSON

When you need to use a schemas in the request or response, simply click the type (e.g., object) and select "Reference other schemas" from the pop-up list.

Reference other schemas

Select the pre-defined shemas from the list and the parameters are automatically populated into the API.

Data Type

If you need to add or modify some parameters, you can modify them in the corresponding “Data Schema”, or dereference them. When dereference, the request parameters are no longer dependent on the common data model, but exist independently and belong exclusively to the current API.

Modify data schemas

Method 4: Importing cURL Commands

Apidog supports direct importing of cURL commands, allowing for quick setup of request parameters, especially for APIs from third-party platforms that provide cURL commands for testing purposes, such as Shopify API.

Importing cURL Commands

To import a cURL command, simply copy the provided command and paste it into the address bar of a new API. Apidog will automatically parse the cURL command and generate the corresponding request parameters.

Parse cURL command

You can also click the "+" button next to the search box in your project, select "Import cURL," paste your copied command into the dialog, and click "OK."

Import cURL
Paste cURL

Upon saving as an API, the JSON request body will automatically be structured to match the API documentation.

Save as Endpoint
Header Body Params

Conclusion

This article has presented various methods for batch adding request parameters in Apidog. You can use the bulk edit functionality for CSV data, generate parameters from JSON or XML formats, import from databases, utilize predefined parameter templates, or directly import cURL commands. These diverse approaches enable you to efficiently manage your API request parameters according to your needs.

button

Join Apidog's Newsletter

Subscribe to stay updated and receive the latest viewpoints anytime.

Please enter a valid email
Network error, please try again later
Thank you for subscribing!