This documentation is for WSO2 App Factory 1.0.0. View documentation for the latest release.

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Introduction

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

...

Up and running App Factory (https://appfactorypreview.wso2.com/appmgt) 

Sample API 'twitter yahoo weather - 1.0.0' with following configurations in WSO2 API STORE (https://apimanager.appfactorypreview.wso2.com/publisher)

             # ProducitonUrl - http://weather.yahooapis.com/forecastrss?w=2502265

             # Select Auth Type of API Resource as Application & Application User as shown below.

Image Added

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

...

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


Image RemovedImage Added


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

...

5. Subscribe the application to the Yahoo 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 (https://apimanager.appfactorypreview.wso2.com/store/).
  • Click on 'twitter yahoo weather - 1.0.0' application.

    Image RemovedImage Added

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

...

7. Deploy the application to "Development" environment and add the endpoint and click 'Submit'.     E.g: . Launched app look as follows.

   Image Added

      # Give APIManager Url (Eg:- http://apimanager.appfactorypreview.wso2.com - must be a HTTP url).

      # Give end point Url of the Yahoo Weather API. (Eg:- http://apimanager.appfactorypreview.wso2.com:8280/twitteryahooweather/1.0.0/search.atom?q=wso2  ).

      # Give Username & Password of the logged user.

      # Click on Submit.

  # Response with weather information will be printed as an XML.

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

...