This sample demonstrates how to subscribe to a published API and consume its functionality using the API Store Web application. We use the Wikipedia API here.
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.
The scripts used for this sample do not work in Windows. Support for Windows will be added in an upcoming release.
Executing the Sample
- 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.
- There are no APIs created yet. To create one and publish it to the API Store, run the following:
- On Linux:
- On Windows:
- On Linux:
- Refresh the API Publisher to see the Wikipedia API created.
- You can now access Wikipedia through this newly-deployed API. Log in to the API Store
(http://localhost:9763/store)using credentials subscriber1/subscriber1.
- Select the Applications tab at the top of the page, and create a new application. Provide any name you like.
- Select the APIs tab at the top of the page, select the
WikipediaAPIAPI and subscribe to it using the newly-created application.
- 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.
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.
You must see the JSON result from the Wikipedia API on you console. For example,
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.