Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Bulk Partner Management Tool for Mule

DZone's Guide to

Bulk Partner Management Tool for Mule

Read this short tutorial to learn how to use the Bulk Partner Management Tool for Mule and explore how it was built as well as it's purpose.

· Integration Zone ·
Free Resource

SnapLogic is the leading self-service enterprise-grade integration platform. Download the 2018 GartnerMagic Quadrant for Enterprise iPaaS or play around on the platform, risk free, for 30 days.

Purpose:

Once we develop our APIs, we need to onboard customers and provide access to the APIs specific to the environment. In API management, partner onboarding can be challenging when there are a lot of partners. However, this process can be done easily using Access Management API provided by Mule, and there is a tool named 'Bulk Partner Management Tool'.

GitHub URL:

https://github.com/Baran121/mulkpartnermanagement

To Run This Tool:

https://github.com/Baran121/muleanypointbulkpartnermanagement/wiki

Using This Tool:

  1. You can create client applications in Mulesoft Anypoint platform in bulk.
  2. Give access to the APIs you want.

Input Format:

  1. This tool expects Anypoint username and password
  2. JSON format
{
	"applications": [
		"my-partner-moto1",
		"my-partner-moto2"
	],
	"apis": [
		"my-apps-api1",
		"my-apps-api2"
	],
	"environment": "QA"
}

How to Run This Tool:

  1. Download node js and install in your windows machine.
  2. Download and run route.js file using this command "node route.js".
  3. Feed your Anypoint username, password, and JSON input file and press the provision button.

How This Tool Has Been Built:

1. This tool uses Mule exposed APIs for partner management functionality known as Access Management APIs.

2. The main functionality of this tool resides in the route.js file. Have a look at them first.

callLogin.loginAP(req, res, function(data) {
 /*res.render('./fetchAPIs.ejs', {title: data});*/
 getOrgId.getOrgId(req, res, data.access_token, function(orgData) {
  console.log('Logged in');
  /* create applications */
  if (jData.applications != null)
   jData.applications.forEach(function(applicationName) {
    getIndiApplicationName.getApps(req, res, data.access_token, orgData.user.organization.id, applicationName, function(application) {
     if (application.applications != null)
      application.applications.forEach(function(apps) {
       if (apps.name == applicationName) {
        applicationId = apps.id;
        console.log(applicationId);
       }
      });
     if (applicationId == '') {
      createApplications.createApplications(req, res, data.access_token, orgData.user.id, orgData.user.organization.id, applicationName, function(appCreatestatus) {
       applicationId = appCreatestatus.id;
       console.log('Application Created Successfully');
      });
     }
     /* get apis*/
     getAPIs.getApis(req, res, data.access_token, orgData.user.organization.id, function(apis) {
      /* loop apis */
      if (apis.total > 0) {
       console.log('Got APIs list');
       apis.apis.forEach(function(apiElement) {
        /* loop api versions*/
        apiElement.versions.forEach(function(verElement) {
         if (verElement != null) {
          jData.apis.forEach(function(apiName) {

           if (apiName == verElement.assetId && verElement.name.indexOf(jData.environment) != -1) {
            /* create permissions or contracts */
            createContracts.createContracts(req, res, data.access_token, orgData.user.id, orgData.user.organization.id, applicationId, verElement.id,
             function(contractCreatestatus) {
              console.log('Creating Contracts...:' + apiName);
              successfulAPIs.push(apiName);
             });
           }
          });
         }
        });
       });
      } else {
       console.log("There is no API available");
      }
      res.render('login.ejs', {
       successfulAPIs: successfulAPIs
      });
      res.end();

     });

    });
   });
 });

});

Download A Buyer's Guide to Application and Data Integration, your one-stop-shop for research, checklists, and explanations for an application and data integration solution.

Topics:
anypoint platform ,mule esb ,json ,node js ,anypoint ,mule

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}