Skip to main content

Server Configuration

You can specify Server configuration by navigating to the Settings > Server Configuration section in API editor.

Server configuration

Server configurations can be used to create multiple environments, multiple servers that can be used with specific endpoints and server URLs with template parameters.

Server configuration

Environments

An environment consists of a set of servers with base URL values. The environment can be changed programmatically allowing rapid switching between different environments.

For example, the user can specify a Production and Testing Environment and switch between them in the generated SDK.

Adding a new environment

note

A production environment has already been generated with a default server for you.

A new environment can be created by clicking on the + Environment sign.

Add new environment

Following information is required:

Name

This is the name which you want to give to the environment.

Description

This is a brief description which you want to give to the environment.

URL

This is the URL of the server for the environment.

Add a new environment

Servers

The user can specify multiple servers within an environment. A server comprises of a name and a url. The names of the hosts remain consistent over different environments but their values may vary.

The URL values can contain any number of parameters defined, for example {scheme}://{basepath}.com:{port}. All of these parameters have to be defined in the template parameters section. These servers can be used on the endpoint level to specify base URLs for specific endpoints. This structure allows a user specifying any number of root urls e.g. the user may specify a Default and an Auth server.

Adding a new server

note

A default server has already been generated for you.

A new server can be created by clicking the + Add new button in the servers section below the already added servers.

Add a new environment

Following information is required:

Name

This is the name which you want to give to the server.

URL

This is the base URL for the server.
caution

You must enter corresponding Server URL values for all available environments.

Add a new server

Template Parameters

Template parameters can be used inside URLs and changed programmatically at runtime.

Adding template parameters

Template parameters can be created by clicking on the + Add new button in the Template Parameters section.

Adding Template Parameter

Following information needs to be provided for a template parameter:

Name

This is the name given to the template parameter.

Description

This is the brief optional description of the template parameter.

Default Value

This helps you specify a default value for the template parameter. This field is mandatory.

Type

This is the type assigned to the template parameter. A template parameter can be of the following types:
  1. String
  2. Number
  3. Number Enumeration
  4. String Enumeration

Example

This option helps you include a sample value for the parameter that will be used in the documentation to indicate what the parameter value can look like. This example must be valid according to the parameter type specified in Type.

Default Settings

You can set the default environment and server here.

Default Environment

This is the environment to be used by default across the API. The environment can be changed programmatically in the SDK.

This can be set in the Environment dropdown as follows:

Default environment

Default Server

This is the server to be used by default. This can be overridden at the endpoint level.

This can be set in the Server dropdown as follows:

Default server

Overriding Endpoint Base URL

The base URL for a specific endpoint can be overridden in the Endpoints section.

  1. Go to the endpoint you wish to change the base URL for.
  2. In the Endpoint Settings section, choose the server to be used with the endpoint.

Overriding endpoint Base URL

Changing Environment for Generated Tests

The environment to be used for the generated tests can be can be set in Settings > TestGen Settings section from the Environment dropdown.

Test environment

Exporting to other formats

The default server's Url value for the default environment will be used as the base URL when exporting to other formats like Swagger, API Blueprint etc.