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¶
-
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. -
Click KEY GENERATION WIZARD to start the key generation wizard.
-
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 toOauth
, Select Oauth as the Token Type and continue. -
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.
-
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.
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.
-
Select the access token validity period and scopes to generate an access token to invoke the API, then click Next to continue.
-
Copy the generated access token.
-
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.
Subscribe to an existing application¶
If you already have an existing application, follow the instructions below to subscribe to the API using that application.
-
Sign in to the Developer Portal (
https://<hostname>:<port>/devportal
) and click on the API (e.g.,PizzaShackAPI
) to go to the API overview. -
Click SUBSCRIBE TO AN APPLICATION.
-
Select the application, the throttling policy, and click Subscribe.
You can see the subscriptions list in API credentials section.
Unsubscribe from an API¶
Follow the instructions below to delete the API subscription:
-
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. -
Click Credentials.
-
Select the subscription that you need to delete and click UNSUBSCRIBE.