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 generate and use a single key to a collection of APIs in an application. Applications also enable a consumer to subscribe to one API multiple times with different SLA levels.
- Click the New Application... option to open the Add New Application page.
Through this window, new applications can be created, and the existing applications can be edited or deleted.
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 Default Application and it can have any number of requests per minute. That is, its throttling tier is unlimited. 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 other levels of throttling tiers. The final request limit granted to a given user on a given API is ultimately defined by the summed output of all of these different throttling tiers together. 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. All resource level throttling tiers are unlimited. 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, 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. Select Go to My Subscriptions.
- 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.