Subscribe to an API

You have to subscribe to a published API before using it in your applications. The subscription process fulfills the authentication process and provides you with access tokens that you can use to invoke an API.

The examples here use the PizzaShackAPI REST API, which is created and published to Developer Portal in WSO2 API Manager.

The following are the two methods available in the Developer Portal to subscribe an API to an application.

  • Subscribe to an existing application

    You can subscribe to a current API by selecting an existing application.

  • Subscribe to an API using Key Generation Wizard

    You can use the KEY GENERATION WIZARD option to start the subscription process from scratch. The KEY GENERATION WIZARD guides you through the process of creating and configuring an application, generating application keys and access tokens, and finally navigates you to the try out page.

Subscribe to an API using Key Generation Wizard

  1. Sign in to the WSO2 API Developer Portal (https://<hostname>:<port>/devportal) and click on the API (e.g., PizzaShackAPI) to go to the API overview.

    API overview

  2. Click KEY GENERATION WIZARD to start the key generation wizard.

    Key Gen Wizard

  3. Enter the application details in the Create application process and click Next to continue.

    Note that the default token type is JWT. If you want to change the token type to Oauth, Select Oauth as the Token Type and continue.

    Create application process in the wizard

  4. Subscribe the API to the application that you created in above step by selecting the preferred throttling policy. Thereafter, click Next to go to next step.

    Subscribe to new application process

  5. Generate application keys (Production or sandbox) by selecting the grant types which need to be allowed for this application. Thereafter, click Next to continue.

    The application key and secret is generated in this step.

    Key generation

    Note

    • By default, the Client Credentials grant type is used to generate the access token. Make sure the Client Credentials grant type is selected when generating keys from the UI.
    • If you have a supported callback URL that sends a callback to a specific server or program soon after your application request is sent, you can specify it under the Callback URL field.
  6. Select the access token validity period and scopes to generate an access token to invoke the API, then click Next to continue.

  7. Copy the generated access token.

  8. Click Finish to complete the wizard or click Test to navigate to the API Console so that you can invoke and try out the API.

    Copy access token

Subscribe to an existing application

If you already have an existing application, follow the instructions below to subscribe to the API using that application.

  1. Sign in to the Developer Portal (https://<hostname>:<port>/devportal) and click on the API (e.g., PizzaShackAPI) to go to the API overview.

    API overview

  2. Click SUBSCRIBE TO AN APPLICATION.

    Subscribe to new app

  3. Select the application, the throttling policy, and click Subscribe.

    Subscribe to new application

    You can see the subscriptions list in API credentials section.

    Subscribe to new app

Update the subscription tier

  1. Sign in to the WSO2 API Developer Portal (https://<hostname>:<port>/devportal). Click on Applications and select the relevant application.

    ![applications overview_tab]

  2. Click Subscriptions to list the subscriptions of the application.

    Subscriptions overview_tab

  3. Click the EDIT icon of the subscription whose tier needs to be changed, to open the subscription update popup.

    Subscriptions update_popup

  4. Select the throttling tier that needs to be updated and click Update. This will update the existing subscription with the newly selected throttling tier.

    Subscription_update_completed

Follow the steps mentioned in Adding an API Subscription Update Workflow if you need to configure an approval process to update the subscription tier.

Unsubscribe from an API

Follow the instructions below to delete the API subscription:

  1. Sign in to the WSO2 API Developer Portal (https://<hostname>:<port>/devportal) and click on the API (e.g., PizzaShackAPI) for which you need to delete the application subscription.

    API Overview

  2. Click Credentials.

    API credentials

  3. Select the subscription that you need to delete and click UNSUBSCRIBE.

Top