This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.
Grouping APIs with Labels
This documentation is for the API Microgateway component that is coupled with WSO2 API Manager 2.6.0.
View the documentation for the latest release - WSO2 API Microgateway 3.0.2.
It is possible to create a Microgateway distribution for a group of APIs. In order to group APIs, a label needs to be created and attached to the APIs that need to be in a single group.
Creating and attaching a Microgateway to an API
Log in to the Admin portal (
https://<hostname>:9443/admin
). Useadmin
as the username and password.- To add a new Microgateway label, click LABELS under MICROGATEWAY, and then click ADD MICROGATEWAY.
Create a new label (e.g. MARKETING_STORE), add a host (e.g.
https://localhost:9095
) and click Save.- Navigate to the API Publisher (
https://<hostname>:9443/publisher
). Sign in usingadmin
as the username and password. - Deploy the sample Pizzashack API by clicking Deploy Sample API if you have not already done.
Choose to edit the created Pizzashack API.
Navigate to the Manage section and click Gateway Environments.
- Select the newly created label to attach it to the Pizzashack API.
- Click Save & Publish.
- Similarly, you can select MARKETING_STORE label for few other Published APIs.
Generating a Microgateway distribution for a label
Run the initial setup command for the MARKETING_STORE label after navigating to a preferred workspace folder.
micro-gw setup <project name> -l <label name>
Here is a sample:
micro-gw setup marketing_project -l MARKETING_STORE
Build the microgateway distribution for the project using the following command:
micro-gw build marketing_project
Once the above command is executed, the generated source files are built and a Microgateway distribution is created under the target folder.
Next, unzip the
micro-gw-marketing
-project.zip
and run thegateway
shell script inside the bin folder of the extracted zip using the following command:bash gateway
The Microgateway starts for the APIs grouped with
MARKETING_STORE
label you just created.micro-gw-marketing-project/bin$ bash gateway ballerina: HTTP access log enabled ballerina: initiating service(s) in '/home/user/workspace/marketing-project/target/micro-gw-marketing-project/exec/marketing-project.balx' 2018-06-29 21:16:44,142 INFO [wso2/gateway:0.0.0] - Subscribing writing method to event stream ballerina: started HTTPS/WSS endpoint 0.0.0.0:9096 ballerina: started HTTPS/WSS endpoint 0.0.0.0:9095 ballerina: started HTTP/WS endpoint 0.0.0.0:9090
Viewing Microgateway labels in the API Store
- Log in to the API Store (
https://<hostname>:9443/store
). Useadmin
as the username and password. Any attached Microgateways are shown in the Overview tab of the API.