Configuring API Servers
A RESTful API can be served over multiple environments. To define these environments (or servers) in the plugin, we use
the Servers tab. Data entered in this tab is eventually mapped to the OpenAPI specification's
servers
field.
Server Fields
Every server will be defined through the following fields:
Name | Description | Example |
---|---|---|
Url | The base URL of the server. The base URL can have path parameters (defined through curly braces {} ) for flexibility. |
https://{username}.app-us1.com/api/{version}/ |
Description | A short description of the server. | US production URL. |
Apply to all | A checkbox indicating whether or not the plugin should use this server for all existing operations. | |
Variables | The collection of variables present in the provided base URL. |
Variable Fields
Each variable is defined through the following fields:
Name | Description | Example |
---|---|---|
Name | The name of the variable in the path. The name is derived from the word enclosed in curly braces. | From https://{username}.app-us1.com/api/{version}/ , we have two variables named username and version . |
Enum | This field allows you to specify valid values for the variable. Possible values are separated by new lines. | v1 v2 v3 |
Default Value | The default value for the variable. | v2 |
Description | Describes the variable's purpose. |
Adding an API Server
To add a server, follow these steps:
- Click the green, '+'-labeled button at the top left corner of the Servers tab.
- Enter the server's base URL in the Url field.
- Populate the rest of the server's fields.
- Click the floppy disk icon to save.
- Populate the rest of your path variables' fields.