This documentation is for WSO2 API Manager 1.7.0 View documentation for the latest release.
Page Comparison - Deploying and Testing Wikipedia API (v.2 vs v.3) - API Manager 1.7.0 - WSO2 Documentation

All docs This doc

Versions Compared

Key

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

...

Building the Sample

Execute the steps in Samples Setup. When you are done, you will have the API Manager started and the relevant scripts run to create user accounts for API Publisher and API Store.

 

Note

The scripts used for this sample do not work in Windows. Support for Windows will be added in an upcoming release.

Executing the Sample

  1. If you haven't done so already, start the API Manager and log in to the API Publisher(http://localhost:9763/publisher) using credentials provider1/provider1.
  2. There are no APIs created yet. To create one, run <APIM_HOME>/samples/WikipediaAPI/APIPopulator.sh (on Linux) or <APIM_HOME>/samples/WikipediaAPI/APIPopulator.bat (on Windows).
  3. Refresh the API Publisher to see the Wikipedia API created.
  4. Click on the API, go to its Lifecycles tab and publish the API by selecting its life cycle stage as PUBLISHED.
  5. You can now access Wikipedia through this newly-deployed API. Log in to the API Store (http://localhost:9763/store) using credentials subscriber1/subscriber1.
  6. Select the Applications tab at the top of the page, and create a new application. Provide any name you like.
  7. Select the APIs tab at the top of the page, select the WikipediaAPI API and subscribe to it using the newly-created application.
  8. Go to the My Subscriptions tab and select your application. Click the Generate button associated with the production system to obtain an application access token.
  9. You are now ready to invoke the API. Copy and paste following into a new console and execute it. Be sure to replace the string '9nEQnijLZ0Gi0gZ6a3pZICktVUca' with the application access token you obtained earlier.

    Code Block
    curl -H "Authorization :Bearer 9nEQnijLZ0Gi0gZ6a3pZICktVUca" "http://10.100.5.20:8280/wikipedia/1.0.0?format=json&action=query&titles=Main PageMainPage&prop=revisions&rvprop=content"
  10. You must see the JSON result from the Wikipedia API on you console. For example,

    Code Block
    {"query":{"pages":{"5982813":{"pageid":5982813,"ns":0,"title":"MainPage","revisions":[{"contentformat":"text/x-wiki","contentmodel":"wikitext", "*":"#Redirect [[Main Page]]\n\n{{Redr|mod|rcc}}"}]}}}}... 

    See http://www.mediawiki.org/wiki/API:Main_page for more information about the Wikipedia API. You can try out various API actions and features similar to step 9.