A Backend Developer's Guide:How to use EchoAPI

EchoAPI doesn’t require users to log in and supports a Scratch Pad. It is ultra-lightweight and 100% compatible with Postman script syntax, making it a perfect alternative to Postman.

Recently, I discovered an excellent API development and management tool called EchoAPI. EchoAPI is an ultra-lightweight collaboration tool offering features like API design, debugging, mocking, automated testing, and load testing. Regardless of whether you're a frontend, backend, full-stack architect, test engineer, or project manager, EchoAPI provides a unified experience for API management.

In my opinion, EchoAPI combines the API debugging capabilities of Postman and the mock interface simulation features used by frontend and testing teams, such as those found in JMeter. This integration provides a more powerful and modern tool tailored to the habits of today's developers and teams. Unlike Postman, EchoAPI doesn’t require users to log in and supports a Scratch Pad. It is ultra-lightweight and 100% compatible with Postman script syntax, making it a perfect alternative to Postman.

Download and Installation

Visit the official website: EchoAPI Official Site to download the EchoAPI.

download.png

API Types

EchoAPI supports HTTP, WebSocket, and gRPC interfaces. Here, we'll focus on HTTP interfaces, with core functions divided into four areas: API Design, API Debugging, API Mocking, and Automated Testing.

Ensuring API Quality: How EchoAPI Boosts Your API Testing 🚀
As a developer, making sure every function of your API performs flawlessly is crucial for the system’s reliability and security.

Global Parameters and Directory Parameters

  • Global Parameters: These apply to all environments and directory interfaces, automatically included in requests. Parameters can be fixed values or variables (global or environment).
  • Directory Parameters: Similar to global parameters but limited in scope to specific directory environments.

Creating a New API

Key Focus Areas (marked in red in the app):

1.png
What is a REST API and How to Create One?
REST (Representational State Transfer) APIs are essential in modern web development, facilitating seamless communication between applications. By leveraging a stateless, client-server architecture via the HTTP protocol, REST APIs offer flexibility, scalability, and easy integration.

Design

Design.png

'Design' involves creating the interface first, then writing the code. It can also be provided in advance to the front-end. The interface consists of four parts:

  1. Basic interface information: interface address, interface development status (in development), etc.
  2. Detailed description: a description of the interface.
  3. Predefined request parameters: define the request parameters.
  4. Predefined response expectations: you can predefine the response parameters and impose business constraints, as well as generate response examples. For example, the response JSON must include a token field, and the price field must be a number.

At the beginning of the design, focus on completing parts 1, 2, and 3. Part 4 can be ignored for the time being. After moving on to 【Debugging】, you can import from the existing response examples.

If you're calling an interface written by others, you can directly [debug] without [designing]. If it's an interface you wrote yourself, try to [design] first, then [debug], and afterwards simulate various scenarios for [interface testing]. If you're using IntelliJ IDEA to develop Java interfaces, you can install the EchoAPI for IntelliJ IDEA plugin. Once the interface development is complete, you can upload it to EchoAPI.
API Design and Debugging:A Comprehensive Guide for Beginers
With APIs becoming the backbone of modern applications, it’s essential to follow best practices and use the right tools to ensure robustness and efficiency.

Debugging

Test existing interfaces. The design and debugging components sync automatically upon saving.

debug.png

Test Cases

Consider different scenarios, requiring multiple test cases for each API.

Test Cases
Cases Report

Mocking

While backend developers might not always use this, front-end devs can utilize mock URLs for testing.

Mocking
Note: It's best to provide the cloud MockUrl to the frontend.
Best Practices for API Mocking with EchoAPI
API mocking is crucial in modern software development. By simulating API responses, developers can enable comprehensive testing. Leverage EchoAPI’s user-friendly interface and powerful features to improve data simulation and streamline your development workflow.

Environment Management

EchoAPI supports multiple application environments but not at the individual API level. Switching environments applies globally to all APIs, so be mindful of the current environment status.

Environment Management

Environment Variables

Environment variables handle parameter variations across environments, like IP and port differences. Use {{environment variable}} syntax to access them.

Environment Variables
Variables Use

global variables

The setting of global variables is done through "pre-execution actions" and "post-execution actions." Like environment variables, they are in key-value (KV) format. However, the difference lies in their scope, as global variables are cross-environment. Besides "pre-execution actions" and "post-execution actions," they can also be accessed using {{global_variable_name}}.

Authentication

APIs requiring authentication need tokens. Choose an appropriate authentication protocol for your project and set the token value accordingly.

Authentication

If uncertain, add it directly in the Header, commonly as:

  • Authorization: {{token}}
  • Cookie: {{token}}
What is API Authentication and Why Is It Important?
This article explores what API authentication is, its significance, common authentication methods, and practical examples of implementing these methods using EchoAPI.

Pre-execution Scripts

The pre-execution operations section supports multiple scripting languages, with the most comprehensive support for JS. Therefore, it is recommended to write JS code here.

Pre-execution is not used frequently and is only utilized when complex calculations are required before a request, such as a signing operation. In such cases, the signature cannot be directly confirmed in the request parameters; it must be computed.

Post-Execution Scripts

The post-execution operations are the same as the pre-execution operations, except that after the response is received, the data is processed. This is also used in certain special scenarios, such as assigning values to authentication tokens.

In the past, when debugging interfaces that require authentication, our process was as follows:

Log into the website via browser → Copy the token from the cookies → Paste it into the Header. The downside is that you have to add it to every authentication interface, and once it expires, you'll have to update everything again.

Now we design it like this:

Design and debug the login interface in EchoAPI -> After obtaining the token, set it to environment variable A -> Configure the global parameters to automatically include A with each request; this way, each authentication interface does not need to manually add the token, and when it expires, you only need to call the login interface again.
EchoAPI Tutorial: How to Use Scripts in EchoAPI
This tutorial should give you a comprehensive understanding of how to effectively use scripts in EchoAPI for advanced API testing and development.

Real-Time Response

You can view the response data situation in Real-time Response as follows:

Real-Time Response
image.png

Post-request cookies are managed separately; use the Cookie Manager for settings.

History

The history provides access to historical API requests and responses, useful for backtracking through debugging history.

History

Documentation Sharing

The API documentation can be shared as a web document for the front-end to view. You can share the whole project, directory, or specified interface. I suggest sharing the entire project during development for greater convenience.

Documentation Sharing

Assertions and Validations

Used to check if response data meets requirements, such as response times or JSON structure compliance. Implement assertions in post-execution scripts.

Additional Tips:

  1. Set a password when sharing documents.
  2. Documents auto-update with API saves.

FAQs

Global Parameters vs Global Variables:

  • Global Parameters automatically add to requests;
  • Global Variables require invocation. Global Parameters can employ Global Variables.

Conclusion

In summary, EchoAPI emerges as a versatile and lightweight tool, bridging the gap between various facets of API development and management. By integrating design, debugging, mocking, and testing features, it caters to the modern needs of developers across different roles. Its compatibility with Postman script syntax, coupled with the convenience of not requiring user login, makes EchoAPI a compelling alternative for those seeking an efficient and user-friendly API management solution. Whether you are involved in frontend, backend, or full-stack development, EchoAPI provides a seamless and unified experience, empowering you to manage APIs with greater ease and efficiency.