It explains about how to attach a simple approval workflow to the API subscription operation in the API Manager.
Adding a custom workflow to API subscription enables the consumer to cannot use the API directly. The API can be used only once the subscription is approved by admin in admin portal.
Implementing a simple approval workflow for the API subscription process in the API Manager can provide an effective way to control and manage API access. By attaching a custom workflow, the API consumer cannot use the API directly until their subscription is approved by an administrator in the admin portal.
Walkthrough:
Navigate product page, or click on “https://wso2.com/api-manager/” Download, and then click Zip Archive to download the product distribution as a Zip file.
Navigate to the < wso2am-4.2.0-home>\bat directory, open a terminal.
Run the service:
api-manager.bat
Set up the API manager:
Sign in to API Manager Management Console https://localhost:9443/carbon
- Username: admin
- Password: admin
- Click on sign in
Enabling the API subscription workflow for Approval Workflow Executor:
Navigate to Resources >> Browse >> system >> governance >> apimgt >> application data >> workflow-extensions.xml
- Click on Edit as text.
Comment the Subscription Creation executor which is Subscription Creation Simple Workflow Executor as shown in below.
<!–SubscriptionCreation executor=”org.wso2.carbon.apimgt.impl.workflow.SubscriptionCreationSimpleWorkflowExecutor”/–> |
Uncomment Subscription Creation executor which is the Subscription Creation SimpleWorkflow Executor as shown in below.
<SubscriptionCreation executor=”org.wso2.carbon.apimgt.impl.workflow.SubscriptionCreationApprovalWorkflowExecutor”/> |
Click on Save Content.
Go to the API Developer Portal credentials page and subscribe to an API. If the approval workflow is enabled, then after subscribing you will see the subscription status as ON_HOLD
Sign in to the Admin Portal https://localhost:9443/admin/, list all the tasks for API subscription from Tasks → Subscription Creation and click on approve or reject to approve or reject workflow pending request.
After approving go back to the API Developer Portal credentials page, the application status will be UNBLOCKED.
Successfully the added the subscription approval in API manager. For more information, please write to [email protected].