ApiVersion Configuration
Configure API versions with authentication and connection settings
ApiVersion Configuration
Defines a specific version of an API with its authentication, connection settings, and parameters.
Schema Properties
| Property | Type | Required | Default | Description |
|---|---|---|---|---|
| ApiName | string | Yes | - | Name of the API this version belongs to |
| IsActive | bool | No | true | Whether this API version is active and available for use |
| Parameters | Dictionary<string, object> | No | {} | Configuration parameters specific to this API version |
| Authentication | ApiAuthentication | No | null | Authentication settings for API requests |
| Connection | ConnectionSettings | No | Default settings | HTTP connection configuration |
| Variables | Dictionary<string, string> | No | {} | Variables that can be referenced in API operations |
Authentication Properties
| Property | Type | Required | Default | Description |
|---|---|---|---|---|
| Type | string | Yes | - | Authentication type (e.g., “Bearer”, “Basic”, “ApiKey”) |
| Parameters | Dictionary<string, object> | No | {} | Authentication-specific parameters |
Connection Properties
| Property | Type | Required | Default | Description |
|---|---|---|---|---|
| UseProxy | bool | No | false | Whether to use a proxy for connections |
| AllowAutoRedirect | bool | No | false | Whether to automatically follow HTTP redirects |
| AutomaticDecompression | DecompressionMethods | No | None | Decompression methods to use (None, GZip, Deflate, Brotli) |
| UseCookies | bool | No | false | Whether to handle cookies automatically |
| ConnectTimeout | TimeSpan | No | 00:00:15 | Connection timeout duration |
YAML Example
apiVersion: weik.io/v1
kind: ApiVersion
metadata:
name: northwind-v1
spec:
ApiName: northwind-api
IsActive: true
Parameters:
BaseUrl: https://api.example.com/v1
RetryCount: 3
Timeout: 30
Authentication:
Type: Bearer
Parameters:
TokenEndpoint: https://auth.example.com/token
ClientId: my-client-id
Scope: api.read api.write
Connection:
UseProxy: false
AllowAutoRedirect: true
AutomaticDecompression: GZip
UseCookies: true
ConnectTimeout: 00:00:30
Variables:
Environment: production
Region: us-east-1
Usage Notes
Use ApiVersion configuration to define different versions of an API with version-specific settings. Each version can have its own authentication method, connection settings, and parameters.
The Authentication.Type determines which authentication mechanism to use. Common values include:
Bearer- OAuth 2.0 Bearer token authenticationBasic- HTTP Basic authenticationApiKey- API key in header or query parameterOAuth2- Full OAuth 2.0 flow
The Connection settings control HTTP client behavior. Set AutomaticDecompression to handle compressed responses, and adjust ConnectTimeout based on your API’s response characteristics.
Variables defined at the version level can be referenced throughout the API configuration using the ${variableName} syntax.