Publish to Multiple External API Stores

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/.

Publish to Multiple External API Stores

You can share an API with application developers who are subscribed to the API Stores of other tenants. This allows you to advertise your APIs to a wider community. Subscribers of other tenant stores can view and browse your APIs; however, the users must visit your (the original publisher's) Store to subscribe to the APIs.

The following diagram illustrates the process involved when an API Publisher publishes to multiple API Stores.

Illustrates the process involved when an API Publisher publishes to multiple API Stores
API Publisher publishing to multiple API Stores

The API Publisher of Tenant_1, who is located in Node_1, is publishing an API to it's API Store. In addition to that the API Publisher publishes the API to the following three external stores.

  • API Store of Tenant_2 in same node.

  • API Store of Tenant_3 in same node.

  • API Store of Tenant_1 in Node 2

The capability to publish to external API Stores is not configured by default. Follow the steps below to configure it. In this guide, we use two separate instances of WSO2 API Manager and we publish from one instance to the Store of the other instance.

  1. Copy the WSO2 API Manager product pack to two different locations.
    If needed, you can download the WSO2 API Manager product pack from here

  2. Go to the <API-M_HOME>/repository/conf/carbon.xml file of the second instance and change its port by an offset of 1.
    The port offset is set to avoid the port conflicts that occur when you run more than one WSO2 product on the same host.

    <Offset>1</Offset>
  3. Start both API-M servers. 
    Let's publish from the first instance of WSO2 API Manager to the Store of the second instance, which in this tutorial we consider as the external API Store.

  4. Sign in to the WSO2 API-M management console of the first instance (https://<Server Host>:9443/carbon) as admin.

  5. Click Main> Resources > Browse.


    The Registry opens. 

  6. Go to the /_system/governance/apimgt/externalstores/external-api-stores.xml resource.

  7. Click the Edit as Text link, uncomment the <StoreURL> element under the <ExternalAPIStores> element, and add the details of each external API store that you need to publish APIs to.
    In this example,

    • http://localhost:9764/store  is the API Store of the second WSO2 API Manager instance.

    • You publish to its super tenant's Store (admin/admin).

    • For this tutorial change the DisplayName to Store2, so that it is clear that we are referring to the second WSO2 API-M instance, which we are using as the external Store.

    • The port is 9764 as you incremented it by 1 in step 2.

    • If the second WSO2 API Manager instance has multiple tenants and you want to publish to a tenant's Store, the tenant's Store URL and credentials must be given here. 

    <ExternalAPIStores> <StoreURL>http://localhost:9763/store</StoreURL> <ExternalAPIStore id="Store2" type="wso2" className="org.wso2.carbon.apimgt.impl.publishers.WSO2APIPublisher"> <DisplayName>Store2</DisplayName> <Endpoint>http://localhost:9764/store</Endpoint> <Username>admin</Username> <Password>admin</Password> </ExternalAPIStore> </ExternalAPIStores>

    Note the following in the configuration above:

  8. Click Save Content.

  9. Sign in to the API Publisher of the first instance as admin/admin and if you do not have any APIs that are in the published state created, create an API.

  10. Click on the newly created or existing API.
    Here you see a new tab named External API Stores added to the API Publisher console. 

    View of the link to External API Stores tab
    Link to External API Stores tab
  11. Select the Store that you want to publish to (in this case, Store2) and click Save.

  12. Sign in to the external API Store (in this case, http://localhost:9764/store ) and click on the API that you just published.

    A link appears as Visit Publisher Store, which directs you to the original publisher’s store (in this case, http://localhost:9763/store) through which you can subscribe to the API.

You have successfully added multiple external stores to your registry and published your APIs to them.