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.

...

This sample demonstrates how to invoke yahoo weather API and displays results in a Web application.

Prerequisites

  1. Register and log in to WSO2 App Factory here: https://appfactorypreview.wso2.com/appmgt . See instructions in Getting Started.
  2. Log in to API Publisher (https://apimanager.appfactorypreview.wso2.com/publisher) and add API by the name yahoo weather 1.0.0. Provide the following values in Add New API window.


    For more information on creating an API, see APIs.

...

  1. Log in to App Factory portal and click Add New Application to create a new application with the following specifications:

    Name: API-Invoker
    Application Type: Web Application
    Repository Type: Git

    For more information on creating applications, see Creating and Viewing Applications.
  2.  Check Check out the  API-Invoker source code with using the Git clone command. Its It's folder structure is as follows:

...

  1. Image Added

...

  1.  Write your application to get keys by calling the CarbonContext and Registry APIs. The correct sandbox and production keys (consumer key and consumer secret)

...

  1. are used depending on where the application is deployed

...


  1. Image Added

Image Removed

...

  1.   
  2. You can find the source code of this sample in <AF_HOME>/samples directory

...

  1. and the sample index.jsp with above changes

...

  1. in API_Invoker/API_Invoker/WebContent/index.jsp

...

  1. . 

...

  1. Replace this file in API-Invoker. 

...

  1. Commit the changes

...

  1. to Git repository. 
  2. Subscribe the application to the Yahoo Weather API

...

  1. using steps below:

...


    • In App Factory portal, select the API-Invoker application

...

    • .

...

...

    • .
    • Click

...

    • the yahoo weather - 1.0.0

...

    • API you created earlier. For example,
      Image Added

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

...