This documentation is for WSO2 API Manager 1.3.1 View documentation for the latest release.
Quick Start Guide - API Manager 1.3.1 - WSO2 Documentation
||
Skip to end of metadata
Go to start of metadata

The Quick Start guide gives an introduction to basic features of the WSO2 API Manager by walking you through a step by step process from creating to testing a simple API.

Setting up the API Manager

API Manager setup is relatively very easy. While a more detailed description of the installation steps are given in the Installation Guide, we have given below a summary to get you started fast.

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.3.1/wso2am-1.3.1.zip

3. Extract the zip file to a folder which will be referred to as the <PRODUCT_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."

Creating an API

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

1. Open a web browser and access the URL: https://localhost:9443/publisher

2. You should see the API Publisher log-in screen. Type user/password as admin/admin and click "Login" button.

 

3. The API Provider home page opens with all created APIs listed. Since first-time users haven’t created any APIs so far, they will not see any APIs. Click on the "New API" button which will open the "Add API" window.

4. As our first example, we are going to create an API named FindTweets, which is based on the on-line search functionality provided by Twitter (http://search.twitter.com). Consumers of our FindTweets API will be able to search for Tweets by providing a keyword as the input. Our API will accept both GET and POST requests and the output will be an Atom feed.

Enter following values into the respective fields of the Add API form.
  • Name: FindTweets
  • Context: /twitter
  • Version: 1.0.0
  • Visibility: Public
  • Endpoint Security Scheme: Secured (Default is non secured endpoint)
  • Credentials: admin/admin
  • Production URL: http://search.twitter.com
  • Tier Availability : Gold, Silver, Bronze (select all 3 – this field supports multiple values)
  • Business owner: Bruce Wayne
  • Business owner e-mail: dark.knight@wayne-enterprises.com
  • Technical owner: Peter Parker
  • Technical owner e-mailspidey@dailybugle.com
In this example, we have not provided some fields which are optional. For details of all fields on this screen, refer to section Adding an API.

5. Click the "Create" button at the end of the form to save the API configuration. You will be taken back to the API Provider home page where the new FindTweets API will be listed.

6. By clicking the "FindTweet" API, you can open its "Overview" tab which lists a summary of the information entered when creating the API. The page also has other tabs.

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 will immediately start showing the API state as "PUBLISHED".

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 "FindTweets" API will be listed on the home page itself. Anonymous users also can access this API. To subscribe to an API, it is required to log in.

2. Log in to the API Store using the default admin/admin credentials and click on the "FindTweets" API to go to the API overview page. There you should be able 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.

5. Choose to proceed to the "My Subscriptions" page in the pop-up that appears.

6. The "DefaultApplication" will be displayed there along with its subscription to the "FindTweets" API.

 7. Click the "Generate Production Key" option and then click the "Show Key" option to obtain a key for your application.

Testing the API

Any REST client can be used to invoke the "FindTweets" API. For Curl, use the following command to invoke the "FindTweets" API.

 

curl -v -H "Authorization: Bearer xxxxx" http://localhost:8280/twitter/1.0.0/search.atom?q=wso2
Replace the 'xxxx' with the application key obtained earlier. If the right key is passed, the API Manager will route the call to 'search.twitter.com' and get you an Atom feed consisting of all the recent Tweets tagged with the keyword 'wso2'.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.
  • No labels