Skip to main content

Design

tip

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.

image.png

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.

Configure header input parameters with quick access to common header names via a drop-down menu.

  1. Support for setting the type of parameter
  2. Asterisk *: Indicates whether the parameter is required
  3. Parameter value: Represents an example value of an input parameter
  4. Parameter description: Describes the meaning of the parameter (supports quick filling, you can learn about the Parameter Description Library feature)

image.png

Query

Configure query input parameters.

  1. Support for setting the type of parameter
  2. Asterisk *: Indicates whether the parameter is required
  3. Parameter value: Represents an example value of an input parameter
  4. Parameter description: Describes the meaning of the parameter (supports quick filling, you can learn about the Parameter Description Library feature)

image.png

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.

image.png

  • form-data: supports file uploads and content type selection. Switch to form-data when you need to submit a form with files.

image.png

  • urlencode (x-www-form-urlencoded): Switch to urlencoded when you need to submit a form.

image.png

  • binary: When you need to upload a binary file

image.png

  • msgpack

image.png

  • 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.

image.png

Generate values based on the defined schema.

image.png

- raw (javascript/plain/html) supports source code editing for designing parameter values.  

image.png

Path

Supports RESTful API design by adding variables to the interface path using {} or :

image.png

image.png

Authentication

Supports Bearer token, Basic auth, Digest auth, OAuth 1.0, Hawk authentication, AWS Signature, NTLM Authentication (Beta), Akamai EdgeGrid and other authentication methods

image.png

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.

image.png

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).

image.png

Design Response Example Value

The well-designed schema can also generate a mock response example value.

image.png

Mock Server

tip

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