Publish APIs to stores of multiple tenants in WSO2 APIM

Vithursa Mahendrarajah
2 min readMar 30, 2019

--

APIs created in APIM Publisher can be published to multiple stores. When saying as multiple stores, it could be an external API store or it could be a store of different tenant. Here, I am providing steps to publish an API created by an admin of one tenant to a store of another tenant.

Assume that we have two tenants created in APIM which have tenant domains as pro.com and sub.com. Admin of pro.com publishes an API. By default, it will be available in the store of it’s tenant. But we can make it available in the store of another tenant 😎

For simplicity, we will call tenant which has tenant domain pro.com as publisher tenant and which has tenant domain sub.com as viewer tenant.

External stores for an API can be configured through management console. Since we need to view an API published by the user of publisher tenant, these configurations needs to be done by the admin of publisher tenant.

Management console can be accessed in the URL https://<ip-address>:<port-number>. external-api-stores.xml configuration file can be found in the registry path /_system/governance/apimgt/externalstores. Following parameters need to be configured in external-api-stores.xml.

  1. Store URL - The URL of publisher tenant’s store
  2. Display name - The name that is used to denote the external store. It is visible in Publisher under “External stores” tab
  3. Endpoint - URL of the viewer tenant’s store
  4. Username, password - credentials of user who has permission to create and publish API in viewer tenant.

For instance, I am providing an example configuration to publish API provided by admin of publisher tenant to viewer tenant as admin of viewer tenant:

<StoreURL>http://<ip-address>:<port-number>/store</StoreURL>
<ExternalAPIStore id="Viewer" type="wso2"
className="org.wso2.carbon.apimgt.impl.publishers.WSO2APIPublisher">
<DisplayName>Viewer</Displayname>
<Endpoint>http://<ip-address>:<port-number>/store?tenant= <domain name of viewer tenant></Endpoint>
<Username><username of viewer tenant admin</username>
<Password><password of viewer tenant admin></password>
</ExternalAPIStore>

After adding this configurations, login as admin of publisher tenant in Publisher portal. Select the API that needs to be published to other tenant’s store. There will be an additional tab listing configured external stores as illustrated in figure-1.

Figure-1. External stores in Publisher

APIs can be published to external stores from here. ^_^

--

--

Vithursa Mahendrarajah

Software Engineer at WSO2, Electronic &Telecommunication Engineering Graduate, University of Moratuwa. Also like to be a content crafter ^_^