Versions Compared

Key

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

This guide gives a quick walk through the WSO2 API Manager product to get started fast. It introduces some of the basic features and the process from creating to testing a simple API. For a detailed description of how to install, set up and use the product's features and functionality, see each individual section of this documentation.

This guide covers the following:

Table of Contents
maxLevel3
minLevel3

Setting up the API Manager

  1. Ensure that the following prerequisites are satisfied.
    • JDK 1.6.* or higher installed.
    • JAVA_HOME environment variable is set to <JDK_HOME>. For example, JAVA_HOME=c:/Program Files/java/jdk1.6.0_27.
  2. Download the API Manager Binary distribution from http://dist.wso2.org/products/api-manager/1.4.0/wso2am-1.4.0.zip
  3. Extract the zip file to a folder which will be referred to as the <APIM_HOME> throughout the rest of this guide.
  4. Open a command prompt (or a shell in Linux) and go to <PRODUCT_HOME>/bin directory.
  5. Start the API Manager server by executing wso2server.sh (or wso2server.bat in Windows).
  6. The operation log keep running until the server starts, which usually takes several seconds. Wait until the server has fully booted up and displays a message similar to "WSO2 Carbon started in n seconds."
Info
titleBrowser Language

If the default language settings of your web browser is not English or Spanish you will come across an issue of getting 'null' as the lables in API Publisher and Store. To overcome this you can change the default browser language to English  OR

Rename
APIM_HOME/repository/deployment/server/jaggeryapps/publisher/site/conf/locales/jaggery/locale_en.json ,

APIM_HOME/repository/deployment/server/jaggeryapps/store/site/conf/locales/jaggery/locale_en.json               
two files, replacing 'en' with your language code.
         ex: If the browser is running on Italy language, rename to locale_it.json. 
By following either of above, the API Store and Publisher will display in English. If you want to change the language of the API Store and Publisher Web interface to your local language, see Internationalization and Localization.

 

Creating an API

Now that the API Manager is up and running, let's create a simple API using the API Publisher Web application.

...

Publishing the API

When you create a new API, it's initially in the CREATED state of its life cycle. When an API is in this state, the consumers cannot see it in the API Store. To enable consumers to view and subscribe to this created API, it should be promoted to the PUBLISHED state.

  1. To publish the API, select the Life Cycle tab where you will see a drop down with different states the API can be in.
  2. Select the PUBLISHED state in the drop down and click the Update button to apply the state change. The API Provider immediately displays the API state as PUBLISHED.

    Image Removed

Subscribing to the API as a consumer

Now that the API is published, consumers should be able to see it and subscribe to it through the API Store.

  1. To access the API Store, open a Web browser and type the URL: https://localhost:9443/store. The TestAPI will be listed on the home page itself. Anonymous users also can access this API. You must log in to subscribe to an API.
    Image Removed
  2. Log in to the API Store (Log in link is in the top right-hand corner of the screen) to see the Subscribe option.
  3. To subscribe to an API, you should have an application in place. Select the DefaultApplication in the Applications drop down.
  4. The Tiers drop down lists all the tiers specified when creating the API. Select the Gold tier and click on the Subscribe button.
    Image Removed
  5. Choose to proceed to the My Subscriptions page in the pop-up that appears.
    Image Removed
  6. Click Generate to obtain a key for your application. You need these access keys to invoke the API.
    Image Removed

Testing the API

Any REST client can be used to invoke the TestAPI. For Curl, use the following command to invoke it.

curl -v -H "Authorization: Bearer xxxxx" http://localhost:8280/youtube/1.0.0/most_popular
Replace the 'xxxx' with the application key obtained earlier. If the right key is passed, the API Manager will route the call to 'youtube.com' and get you the results. You can similarly access various other feeds in the YouTube API by changing the last segment of the invoked URL. For example, http://localhost:8280/youtube/1.0.0/top_rated, http://localhost:8280/youtube/1.0.0/most-shared etc.
You now have an introductory understanding of how to create and publish APIs through the API Publisher Web application, and how API consumers can use the API Store to subscribe to an API and invoke it. The proceeding chapters of this documentation provide detailed information on the API Manager, its components along with samples and tutorials.