DEV Community

Auden
Auden

Posted on

How to Test APIs Visually in IntelliJ IDEA?

API testing is an essential part of backend development. Traditional testing methods often require switching between IDE and tools like Postman, which not only interrupts development flow but also reduces efficiency. In this article, I'll introduce a powerful IntelliJ IDEA plugin — Apidog Fast Request, which allows us to test APIs directly within IntelliJ IDEA, offering a more efficient development approach.

What is Apidog Fast Request?

Apidog Fast Request is a plugin designed for IntelliJ IDEA that can detect API endpoints in Java and Kotlin backend projects, support direct testing in the IDE sidebar, automatically generate API documentation and export OpenAPI files, and even synchronize with Apidog platform with one click. Let's explore how to test APIs visually in IntelliJ IDEA.

Image description

Installation

First, you need to install the Apidog Fast Request plugin in IntelliJ IDEA. Open IDEA settings, go to the Plugins page, search for "Apidog Fast Request" and install it. Remember to restart IDEA after installation.

Image description

Alternatively, you can install the plugin through the JetBrains Marketplace.

Image description

Testing Endpoints

After restarting IntelliJ IDEA, you'll see the Apidog icon in the right toolbar.

When you open a Controller class containing API endpoints, you'll notice a green arrow icon next to each endpoint method. This arrow is your entry point for testing. Click it, and the plugin will automatically detect all endpoint information and open a visual testing panel on the right.

Image description

The visual testing panel displays all endpoints in your project. Click on an endpoint to see its details, including HTTP methods (GET, POST, etc.), request paths, and parameter information. In the testing panel, you can:

  • View and modify request parameters

  • Add or modify header information

  • Edit request body (for POST requests)

  • View request history

  • Configure global parameters

When you click the "Send" button, the response will be displayed in real-time. You'll clearly see the response status code, headers, and formatted response data. For JSON responses, the plugin automatically beautifies the display for easy reading.

Image description

Pretty nice, right? Besides these basic features, there are more useful functions to explore.

Advanced Features

Request History

After sending requests, the plugin saves them automatically. You can view them in the "Request History" and resend any previous request with a single click.

Image description

Global Parameters

Beyond modifying parameters for individual endpoints, you can set global parameters that automatically apply to all requests. For example, after setting an Authorization parameter in the header and saving it:

Image description

The Authorization parameter will appear in the header of all subsequent requests.

Image description

Cookie Management

The plugin automatically manages and carries cookies, making testing sessions seamless.

Image description

OpenAPI File Generation

After testing, you can right-click in your project and select "Export OpenAPI" to generate OpenAPI documentation, which can be imported into API management tools like Apidog or Postman. You can also click "Upload to Apidog" to sync endpoints to the Apidog platform for team collaboration.

Image description

Conclusion

The main advantage of using Apidog Fast Request for API testing is the integrated development and testing experience. This not only improves development efficiency but also makes the entire process more streamlined. This integrated approach is particularly suitable for backend developers' daily workflow.

Key points to remember:

  • Ensure your project is running before testing endpoints

  • Configure the correct service address for first-time use

  • Regularly sync endpoint information

With these points in mind, you'll quickly master this powerful tool and make your API development and testing work more efficient and enjoyable.

Top comments (0)