(Optional) Creating the Environment and Environment Variables
Overview
An environment refers to the usage scope of an API. An API can be called only after it is published in an environment. APIs can be published in different customized environments, such as the development environment and test environment. RELEASE is the default and formal publishing environment of the system.
Environment variables are specific to environments. If environment variables are defined in backend information of an API, you need to add the variables to the environment. You can create variables in different environments to call different backend services using the same API.
For example, when an API is created, variable Path is defined in the backend request path. Two variables with the same name are respectively created and assigned values /Stage/test and /Stage/AA in environments 1 and 2. If the API is published and called in environment 1, the path /Stage/test is used. If the API is published and called in environment 2, the path /Stage/AA is used.
Creating an Environment
- Log in to the ROMA Connect console. On the Instances page, click View Console next to a specific instance.
- In the navigation pane on the left, choose API Connect > API Management. On the Environments tab page, click Create.
- In the dialog box displayed, configure environment information and click OK.
Table 1 Parameters for creating an environment Parameter
Description
Name
Enter an environment name. It is recommended that you enter a name based on naming rules to facilitate search.
Description
Enter a brief description of the environment.
When a user needs to call an open API, the API in the RELEASE environment is called by default. To access an API in another environment, add the X-Stage parameter to the header of the API request. The parameter value is the environment name. For example, to access an API in the Develop environment, add X-Stage: Develop to the header of the API request.
Creating an Environment Variable
- Log in to the ROMA Connect console. On the Instances page, click View Console next to a specific instance.
- In the navigation pane on the left, choose API Connect > API Management. On the API Groups tab page, click More > Manage Variable in the Operation column of the target API group.
- Select the environment for which you want to add a variable and click Create Variable.
- In the dialog box displayed, configure environment variable information and click OK.
Table 2 Parameters for creating an environment variable Parameter
Description
Name
Enter the variable name, which must be the same as that defined in the API backend service information.
Value
Enter the value of the environment variable.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot