Subscribing to APIs
Follow the instructions below to subscribe to an API.
- Log in to the API Store using the Login link at the top, right-hand corner of the window (You can also self sign-up if no account exists).
- It shows all APIs currently published to the API Store. You can use the search facility or Tags to look for a specific API you are looking for.
- Click an API to view its details. Subscribed users can add ratings and comments to an API.
- Choose an application from the Applications drop-down list. You can use the default application named DefaultApplication, or create a new one.
Applications
An application is a logical collection of one or more APIs, and is required when subscribing to an API. Consumers can create a logical application in WSO2 API Manager or use an existing one to subscribe to all the relevant APIs using that application. To invoke any API in an application, you need to obtain a key. Applications decouple the consumers from the APIs and allow a consumer to ge nerate and use a single key to a collection of APIs in an application. Applicatio ns also enable a consumer to subscribe to one API multiple times with different SLA levels.
- If you click the New Application... option, the Add New Application window opens in the My Applications tab.
Through this window, you can create new applications and edit or delete existing ones.
Application-Level Throttling Tiers
An application can be available to a consumer at different levels of service. For example, if you have infrastructure limitations in facilitating more than a certain number of requests to an application at a time, the throttling tiers can be set accordingly so that the application can have a maximum number of requests within a defined time. WSO2 API Manager comes with three default tiers, which are 'Gold', 'Silver' and 'Bronze' as defined below:
- Bronze - Allows 1 request per minute.
- Silver - Allows 5 requests per minute.
- Gold - Allows 20 requests per minute.
In addition, there is also a special tier called 'Unlimited' which gives unlimited access. The WSO2 API Manager provides an application out-of-the-box by the name DefaultApplication and it can have any number of requests per minute. You can change this and set it to a restricted limit by editing the default application.
In addition to application-level throttling, you can also define API-level throttling tiers. The final request limit granted to a given user on a given API is ultimately defined by both the application-level as well as the API-level throttling limits. For example, lets say two users subscribe to an API using the Gold subscription which allows 20 requests per minute. They both use the application App1 for this subscription, which again has a throttling tier set as 20 requests per minute. In this scenario, although both users are eligible for 20 requests per minute access to the API, each ideally has a limit of only 10 requests per minute. This is due to the application-level limitation of 20 requests per minute.Callback URL
A callback URL is optional for an application. If specified, you can use it in the authorization code grant type when invoking an API. See Generating authorization code.
- Once an application is selected, next select a tier (API-level throttling tier) for the subscription from the Tiers drop-down list. This list of tiers is defined for the API at the time of API creation as described in section Adding an API -> Tier Availability.
The description of each tier is shown below the Throttling Tiers field. - Once an application and a tier is selected, click the Subscribe button.
- If the subscription is successful, a message appears. Chose to go to My Subscriptions tab.
- The My Subscriptions tab opens. You have now successfully subscribed to an API.
If the subscribed API needs authentication to invoke it, you need to have an access token before using the API in your applications. Find out how to obtain an access token to invoke an API.