This documentation is for WSO2 App Factory 1.0.0. View documentation for the latest release.
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 15 Next »

The sample is described in the following topics.


This sample invokes twitter API and display results in a web app.


Up and running App Factory ( 

Sample API 'twitter - 1.0.0' in WSO2 API STORE (

Note: You can create your own API by referring Quick Start Guide#CreatinganAPI

Executing the Sample

 1. Create a web application in AppFactory. Lets call it API-Invoker application. When you create an application in App Factory it will be automatically created in API-M.

 2. Checkout the API-Invoker source code with git clone command. Its folder structure is as follows:

3. Write your application to get keys by calling the CarbonContext and Registry APIs. The correct sandbox and production keys will be used depending on where the application is deployed.

Note: A sample index.jsp is attached with the above changes.   index.jsp 

         Replace this file in API-Invoker.

4. Commit the changes made with git commit command.

5. Subscribe the application to the Weather API as follows:

  • Click on API-Invoker application in Home page.
  • Click on 'Configure Resources' menu item.
  • Go under 'APIs' section and click 'Subscribe' button.
  • Go under 'Subscribe to an API' section and click 'Add Api' button.
  • You will be redirected to API Manager Homepage (
  • Click on 'twitter - 1.0.0' application.

  • Select API-Invoker from 'Applications' drop down and click 'Subscribe' button. You will get the 'Subscription Successful' pop-up.

6. Generate keys for API-Invoker from App Factory.

  •  Go under 'Subscribe to an API' section and click 'Add Api' button.
  •  Go under 'Saved Keys' section and click 'Generate Keys' button and keys will be generated for sandbox and production separately. 

7. Deploy the application to "Development" environment and add the endpoint and click 'Submit'.


8. Promote the application to "Production" environment and view results.

Note: The results of Development environment  differs from Production environment because the keys that is used by the two environments are different. The programmer is unaware about the sandbox and production keys, and everything is handled underneath.

  • No labels