Server Introduction
AngusTester's servers ensure developers can efficiently manage and test API interfaces. Through flexible server definitions and variable management, teams can easily adapt to
different development environments and version control
requirements, thereby improving overall development efficiency and software quality.
About Servers
In API design and implementation, the server component is a critical part. By integrating with interface servers, you can:
- ✅ Automatically switch to test environment servers during testing
- ✅ Automatically update production environment URLs upon release
- ✅ Synchronize variable configurations automatically during version changes
AngusTester provides comprehensive definitions for servers and their dynamic components, including two main sections: Server
and Variables
.
Server Composition
The server composition includes the full URL, server, endpoint, and their relationships. This structured approach not only simplifies API usage but also enhances project maintainability and scalability.
Full URL (path) composition diagram:
https://dev-api.example.com/v1/users?role=admin&status=active&page=1
\_________________________/\_______/ \____________________________/
server URL endpoint query parameters
Can be broken down into:
- Full URL: https://dev-api.example.com/v1/users?role=admin&status=active&page=1
- Server: https://dev-api.example.com
- Version: v1
- Endpoint: /users
- Query Parameters: ?role=admin&status=active&page=1
Defining Variables
Variables enable dynamic server configuration and automatic switching to accommodate various API application scenarios.
Full URL (path) variable application diagram:
https://{env}-api.example.com/{apiVersion}/users?role=admin&status=active&page=1
\___________________________/\___________/ \____________________________/
server URL endpoint query parameters
Variable and custom value examples:
- env: prod, beta, dev
- apiVersion: v1, v2
Server Field Information
AngusTester's interface servers and variables comply with the OpenAPI 3.0 specification. For more details, refer to: OpenAPI Server Object.
Basic Server Configuration
Parameter | Field Name | Type | Required | Length Limit | Description |
---|---|---|---|---|---|
URL Template | url | string | Yes | ≤400 | Target host URL, must follow standard format (supports template variables like {env} ) |
Description | description | string | No | ≤800 | Server description, supports CommonMark rich text syntax |
Variable Definitions | variables | map | No | / | Variable substitution definitions for URL templates |
Extension Properties | extensions | map | No | / | OpenAPI specification extension properties |
Server Variable Configuration
Parameter | Field Name | Type | Constraint | Length Limit | Description |
---|---|---|---|---|---|
Enum Values | _enum | list | No | / | List of optional values (cannot be empty when defined) |
Default Value | _default | string | Conditional | ≤400 | Default value (must be one of the enum items if enum is defined) |
Description | description | string | No | ≤800 | Variable description, supports CommonMark rich text |
Extension Properties | extensions | map | No | / | OpenAPI specification extension properties |