Design
API design primarily caters to the needs of R&D personnel who prioritize APIs, enabling the pre-definition of request parameters and expected responses. If your goal is solely to debug an interface, you can skip the design page and head directly to the debugging section.
Basic Interface Information
In the design tab, you can define the interface's development status, tags, and extended attributes (configurable in project settings). For more detailed descriptions, such as icons or tables, you can edit them using Markdown under the Detailed Description section.
Defining Interface Request Parameters
You can visually define the interface's request header, query, and other input parameters. If multiple interfaces within a project share common parameters, use the global parameter feature to set these inputs quickly across the entire project.
Header
Configure header input parameters with quick access to common header names via a drop-down menu.
- Support for setting the type of parameter
- Asterisk *: Indicates whether the parameter is required
- Parameter value: Represents an example value of an input parameter
- Parameter description: Describes the meaning of the parameter (supports quick filling, you can learn about the Parameter Description Library feature)
Query
Configure query input parameters.
- Support for setting the type of parameter
- Asterisk *: Indicates whether the parameter is required
- Parameter value: Represents an example value of an input parameter
- Parameter description: Describes the meaning of the parameter (supports quick filling, you can learn about the Parameter Description Library feature)
Body
Supports multiple data formats: none
, form-data
, x-www-form-urlencoded
, binary
, msgpack
, and raw (json/xml/javascript/plain/html)
.
- none: there is no request body.
- form-data: supports file uploads and content type selection. Switch to form-data when you need to submit a form with files.
- urlencode (x-www-form-urlencoded): Switch to urlencoded when you need to submit a form.
- binary: When you need to upload a binary file
- msgpack
- raw: When you need to send a JSON object or other objects, switch to the corresponding raw type.
- raw (json/xml) format, supports schema design for hierarchical interface parameters in json or xml.
Generate values based on the defined schema.
- raw (javascript/plain/html) supports source code editing for designing parameter values.
Path
Supports RESTful API design by adding variables to the interface path using {}
or :
Authentication
Supports Bearer token, Basic auth, Digest auth, OAuth 1.0, Hawk authentication, AWS Signature, NTLM Authentication (Beta), Akamai EdgeGrid and other authentication methods
Defining Response Example
New Response
In the same request, you can set multiple expectations for different data structures returned under various scenarios. As shown in the figure, click on [New Response], you can select the expected status code, fill in the expected name, and choose the content format, click [Confirm] to successfully create a new one.
Schema
You can choose from four content type: JSON, XML, HTML, Binary. Among them, JSON/XML formats can be designed through a visual approach to expect the schema of the response (you can learn about the use of schema).
Design Response Example Value
The well-designed schema can also generate a mock response example value.
Mock Server
Once you've defined the interface's request parameters and response expectations, a Mock URL can be automatically generated, allowing the frontend and testing teams to begin development early.
EchoAPI provides intelligent Mock services that support filling in some trigger conditions and setting the expectations to be used when the conditions are met/unmet. After enabling intelligent expectations, EchoAPI will match the preset parameter judgment rules according to the set trigger conditions, and if the conditions are met, the preset expectations will be activated. For specific usage, you can refer to the relevant documentation