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 paramters.
Environments
An environment consists of a set of servers with base URL values. The environment can be changed programatically 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
A new environment can be created by navigating to the Settings > Server Configuration
section in the API Editor.
Note A production environment has already been generated with a default server for you.
- Click the ‘+’ sign below the default settings section.
- Input the name and description of the environment.
A new environment with the specified name and description would be visible now.
Description
This is the basic description of the environment. It can also be removed and edited after the environment has been added.
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 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. For example the user may specify a Default
and an Auth
server”.
Name
This is the name which you want to give to the server.
URL
This is the base URL for the server.
Adding a new server
A new server can be created in the Settings > Server Configuration
section in the API Editor.
Note A default server has already been generated for you.
- Click the ‘+ Add new’ button in the servers section below the already added servers.
- Input the name of the server you wish to create.
- Add the corresponding URLs for the available environments.
warning You must enter Server URL values for all environments.
Template Parameters
Template parameters can be used inside URLs and changed programatically at runtime. Template parameters have the following fields:
Name
This is the name given to the template parameter
Description
This is the brief description of the template parameter
Default Value
If you want to specify a default value for the template parameter, it can be done so here. This field is mandatory
.
Type
This is the type assigned to the template parameter. A template parameter can be of the following types:
- String
- Number
- Integer Enum
- String Enum
Adding template parameters
Template parameters can be created in the Settings > Server Configuration
section in the API Editor.
- Click the ‘+ Add new’ button in the Template Parameters section.
- Add the name, description, default value and type of the parameter.
Note Description is optional.
Server settings
Overrding endpoint base URL
The base URL for a specific endpoint can be overriden in the Endpoints
section.
- Go to the endpoint you wish to change the base URL for.
- In the
Endpoint Settings
section choose the server to be used with the endpoint.
Default Environment:
This is the environment to be used by default. The environment can be changed programatically in the sdk.
This can be set in Settings > Server Configuration
section from the Default Environment
dropdown.
Default Server:
This is the server to be used by default. This can be overridden at the endpoint level. This can be set in Settings > Server Configuration
section from the Default Server
dropdown.
Test generation settings
The environment to be used for the generated tests can be can be set in Settings > TestGen Settings
section from the Environment
dropdown.
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 e.t.c
Have questions? Submit a request.