Download both WSO2 Governance Registry (G-Reg) and WSO2 API Manager.
Provide the API Manager credentials in Replace the
<execution forEvent="Publish" class="org.wso2.carbon.governance.registry.extensions.executors.apistore.ApiStoreExecutor">element in the
<GREG_HOME>/repository/resources/lifecycles/ServiceLifeCycle.xmlfile . For example, the following code block defines an
productionstate. It with a code block which defines an
productionstate as shown in the example below. Add the API Manager credentials in it, so that it provides the API Manager's endpoint, username and password as executor parameters.
Code Block language html/xml
<execution forEvent="Publish" class="org.wso2.carbon.governance.registry.extensions.executors.apistore.ApiStoreExecutorServiceToAPIExecutor"> <parameter name="apim.endpoint" value="http://localhost:9763/"/> <parameter name="apim.username" value="admin"/> <parameter name="apim.password" value="admin"/> <parameter name="apim.env" value=""/> <parameter name="default.tier" value="Unlimited"/> <parameter name="throttlingTier" value="Unlimited,Unlimited,Unlimited,Unlimited,Unlimited"/> </execution>
Note: If you started the G-Reg server at least once before executing step 2, editing the
configurations.xmlfile and restarting the server does not apply the configurations. You need to add the configurations using the G-Reg management console as follows:
- Log in to the G-Reg Management console and select Extensions -> Configure -> Lifecycles menu.
- Click the Edit link associated with
- Add the configuration given in step 2 above and Save.
Run the G-Reg and the API Manager.
When running more than one WSO2 products on the same server, change the default port of one product to avoid port conflicts. You can do this by changing the
<offset>value of one product in
<PRODUCT_HOME>/repository/conf/carbon.xmlfile. In this example, we set the port offset value of Governance Registry to 1 as follows:
Note: If you offset the default API Manager port, you must also change the default API endpoints and the Thrift port accordingly. See Changing the Default Ports with Offset.
Access the API Manager server using the following URL: https://<HostName>:9443/carbon. As you changed the default port of G-Reg, you can access the server using the following URL: https://<HostName>:<9443+offset>/carbon.
Log in to the G-Reg management console and create a new service in it and attach the default service lifecycle to it. For instructions on how to add a new service and associate a new lifecycle, see http://docs.wso2.org/governance-registry/Managing+Services in the Governance Registry documentation.
Add an endpoint attribute to the service you create, which matches the WSO2 API Manager environment you defined in the lifecycle executer in step 2.
Promote the service until it gets to the production state.
When it is in the production state, publish it using the Publish button. You should get a confirmation message once the API is successfully published.
You have now created an API using a service in the Governance Registry. Open the API Publisher to see that this service is successfully created as an API.