API Connect

 View Only

IBM API Connect: How to find what custom modules and themes you have installed on your Developer Portal

By Bhavnit Patel posted Thu March 23, 2023 11:15 AM

  

Introduction

The Developer Portal within IBM API Connect comes with built in modules and themes that you can use to customise your site. You can extend this by installing 3rd party custom modules and themes, or even ones written yourself. If at any point you are unsure which custom modules and themes are installed on your Developer Portal, you can use one of the below methods to find out.

Method 1: Developer Portal Admin Status Report (Recommended)

Log in to your Developer Portal as the Drupal administrator. From here navigate to Manage → Reports → Status report. 

On this page you will see headings for “Custom Modules” and “Custom Themes”:

Checking which of your custom modules are enabled or disabled

Now that you know what custom modules are installed, you can further use the Developer Portal admin toolbar to find out which of these custom modules are enabled or disabled. Navigate to Manage → Extend.

On this page you will see enabled modules checked and disabled modules unchecked:

Checking which of your custom themes are enabled or disabled

Similarly, to see which of your custom themes are enabled or disabled, navigate to Manage → Appearance.

On this page, you will see your themes categorised into “Enabled” and “Disabled”.

Method 2: Developer Portal Toolkit CLI

You can use the custom-module:create-export and custom-theme:create-export commands to extract your custom modules and themes into a compressed file. Within this compressed file you will be able to see a list of your custom modules and themes. 

See https://www.ibm.com/docs/en/api-connect/10.0.5.x?topic=tool-overview-developer-portal-command-line on using the Developer Portal Toolkit CLI and all the other features it offers.

Listing your custom modules

In this example we will log into the Developer Portal Toolkit CLI as a provider, and use the custom-module:create-export command against our Developer Portal by specifying the appropriate org and catalog name:

❯ SERVER=api.fyre-ci-136264-master.fyre.ibm.com
❯ apic login -s $SERVER -r provider/default-idp-2 -u steve
Warning: Using default toolkit credentials.
Enter your API Connect credentials
Password?
Logged into api.fyre-ci-136264-master.fyre.ibm.com successfully

❯ apic -s $SERVER -m portaladmin custom-module:create-export -o ibm -c api-connect-catalog-1
201 CREATED - Task ID: x8jupowmktkf8f2r

Response Code - 202:

Message(s) -
The status of this task is: QUEUED

Response Code - 200:

Message(s) -
The status of this task is: FINISHED and the artifact can now be streamed

Saving File (Large files may take a while)...
Incoming project saved to custom_module_createExport-20230322143819.tgz

Once complete, you can extract your compressed export to see the modules inside, or use tar to view the contents directly:

❯ tar --exclude='*/*' -tvf custom_module_createExport-20230322143819.tgz
drwxr-sr-x aegir/aegir       0 2023-03-22 12:05 chosen/
drwxr-sr-x aegir/aegir       0 2023-03-22 12:05 google_tag/
drwxr-sr-x aegir/aegir       0 2023-03-22 12:05 snowflakes/

Checking which of your custom modules are enabled or disabled

Now that you know what custom modules are installed, you can further use the Developer Portal Toolkit CLI to find out which of these modules are enabled or disabled. You can use the modules:list command to print the list of installed modules, and then search for your custom modules from this result.

❯ SERVER=api.fyre-ci-136264-master.fyre.ibm.com
❯ apic -s $SERVER -m portaladmin modules:list -o ibm -c api-connect-catalog-1 --no-core 
.
.
.
chosen:
  package: 'User interface'
  display_name: 'Chosen (chosen)'
  status: Disabled
  version: 3.0.5
google_tag:
  package: Statistics
  display_name: 'Google Tag Manager (google_tag)'
  status: Enabled
  version: 8.x-1.6
snowflakes:
  package: 'User interface'
  display_name: 'Snowflakes (snowflakes)'
  status: Enabled
  version: 2.0.1
.
.

Listing your custom themes

In this example we will log into the Developer Portal Toolkit CLI as a provider, and use the custom-theme:create-export command against our Developer Portal by specifying the appropriate org and catalog name:

❯ SERVER=api.fyre-ci-136264-master.fyre.ibm.com
❯ apic login -s $SERVER -r provider/default-idp-2 -u steve
Warning: Using default toolkit credentials.
Enter your API Connect credentials
Password?
Logged into api.fyre-ci-136264-master.fyre.ibm.com successfully

❯ apic -s $SERVER -m portaladmin custom-theme:create-export -o ibm -c api-connect-catalog-1
201 CREATED - Task ID: oh595vuywxsz3526

Response Code - 202:

Message(s) -
The status of this task is: QUEUED

Response Code - 200:

Message(s) -
The status of this task is: FINISHED and the artifact can now be streamed

Saving File (Large files may take a while)...
Incoming project saved to custom_theme_createExport-20230322143856.tgz

Once complete, you can extract your compressed export to see the themes inside, or use tar to view the contents directly:

❯ tar --exclude='*/*' -tvf custom_theme_createExport-20230322143856.tgz
drwxr-sr-x aegir/aegir       0 2023-03-22 14:36 emerald_theme_css/
drwxr-sr-x aegir/aegir       0 2023-03-22 14:36 ruby_theme_scss/
drwxr-sr-x aegir/aegir       0 2023-03-22 14:36 sapphire_theme_css/

Checking which of your custom themes are enabled or disabled

Now that you know what custom themes are installed, you can further use the Developer Portal Toolkit CLI to find out which of these themes are enabled or disabled. You can use the themes:list command to print the list of installed themes, and then search for your custom themes from this result.

❯ SERVER=api.fyre-ci-136264-master.fyre.ibm.com
❯ apic -s $SERVER -m portaladmin themes:list -o ibm -c api-connect-catalog-1 --no-core
bootstrap:
  package: Bootstrap
  display_name: 'Bootstrap (bootstrap)'
  status: Enabled
  version: 8.x-3.27
.
.
.
emerald_theme_css:
  package: Bootstrap
  display_name: 'emerald_theme_css (emerald_theme_css)'
  status: Disabled
  version: null
ruby_theme_scss:
  package: Bootstrap
  display_name: 'ruby_theme_scss (ruby_theme_scss)'
  status: Disabled
  version: null
sapphire_theme_css:
  package: Bootstrap
  display_name: 'sapphire_theme_css (sapphire_theme_css)'
  status: Disabled
  version: null

Method 3: Within the Developer Portal running container

If you are unable to access the Developer Portal settings or the Developer Portal Toolkit CLI, then you can look inside the Developer Portal container running within your Kubernetes or OpenShift environment.

Note: You will need access to the Developer Portal Kubernetes pods to be able to perform these steps.

Using kubectl or oc if you are using an OpenShift environment, obtain a shell to the Developer Portal running container. Your Developer Portals are located within the portal-www pod, in the admin container within the namespace that your Developer Portal subsystem is deployed to:

❯ kubectl get pods -n apic | grep www
portal-014179b4-www-0     2/2     Running     0        8d

❯ kubectl exec -n apic -it portal-014179b4-www-0 -c admin -- bash
bash-4.4$

Once in the container, you can use the command list_sites -a to obtain the site alias for your Developer Portal:

bash-4.4$ list_sites -a
daae4642-b1e2-4fd8-a5a7-77a68ed812ef.944dce4f-bbad-41ce-b166-aa2c9f8c4b17 => ibm.api-connect-catalog-1.portal.fyre-ci-136264-master.fyre.ibm.com (INSTALLED)
daae4642-b1e2-4fd8-a5a7-77a68ed812ef.c560c004-852d-42c3-ae4e-797144a857af => ibm.api-connect-catalog-2.portal.fyre-ci-136264-master.fyre.ibm.com (INSTALLED)

In this example, our Developer Portal portal.fyre-ci-136264-master.fyre.ibm.com/ibm/api-connect-catalog-1 has the site alias ibm.api-connect-catalog-1.portal.fyre-ci-136264-master.fyre.ibm.com

Once you have identified the Developer Portal that you want to look at, use the alias string within a find command to list your modules and themes:

bash-4.4$ find /web/platforms/devportal*/sites/ibm.api-connect-catalog-1.portal.fyre-ci-136264-master.fyre.ibm.com/modules -mindepth 1 -maxdepth 1 -type d -exec basename {} \;
chosen
google_tag
snowflake

bash-4.4$ find /web/platforms/devportal*/sites/ibm.api-connect-catalog-1.portal.fyre-ci-136264-master.fyre.ibm.com/themes -mindepth 1 -maxdepth 1 -type d -exec basename {} \;
emerald_theme_css
ruby_theme_scss
sapphire_theme_css

Checking which of your custom modules and themes are enabled or disabled

You can use the drush command line tool within the container to print the list of installed modules and themes for your Developer Portal. Using the site alias you obtained earlier, run the following drush command and find your custom modules and themes.

bash-4.4$ drush @ibm.api-connect-catalog-1.portal.fyre-ci-136264-master.fyre.ibm.com pml --no-core
Running: drush -y @daae4642-b1e2-4fd8-a5a7-77a68ed812ef-944dce4f-bbad-41ce-b166-aa2c9f8c4b17 pml --no-core
 --------------------------------- ----------------------------------------------------------------------------------- ---------- ----------------
  Package                           Name                                                                                Status     Version
 --------------------------------- ----------------------------------------------------------------------------------- ---------- ----------------
  User                              Account Field Split (account_field_split)                                           Enabled
  Access control                    ACL (acl)                                                                           Enabled
  .
  .
  .
  User interface                    Chosen (chosen)                                                                     Disabled   3.0.5
  Statistics                        Google Tag Manager (google_tag)                                                     Disabled   8.x-1.6
  User interface                    Snowflakes (snowflakes)                                                             Disabled   2.0.1

  Bootstrap                         Bootstrap (bootstrap)                                                               Enabled    8.x-3.27
  Bootstrap                         connect_theme (connect_theme)                                                       Enabled    8.x-99.0.15
  Bootstrap                         emerald_theme_css (emerald_theme_css)                                               Disabled
  Bootstrap                         ruby_theme_scss (ruby_theme_scss)                                                   Disabled
  Bootstrap                         sapphire_theme_css (sapphire_theme_css)                                             Disabled

Conclusion

Using either the Developer Portal status report, the Developer Toolkit CLI or the kubectl / oc CLI, you have seen how you can list the custom modules and themes you have installed on your Developer Portal. You can also see which of these custom modules and themes are enabled or disabled. 

We advise that you always keep your custom modules and themes up to date, and remove deprecated code within your own written custom modules and themes. If you are not using a custom module or theme, consider removing it. This will help mitigate problems when you want to migrate or upgrade your Developer Portal.

#portal#developerportal#APIConnect#portalcli#drupal

2 comments
72 views

Permalink

Comments

Fri March 24, 2023 09:27 AM

Hi Ashok - the Developer Portal comes with a sitemap module which is installed from https://www.drupal.org/project/simple_sitemap. Please use this module or another 3rd party Drupal to configure site maps. We currently have no documentation on adding sitemaps with this module, but if you would like this you can request an RFE at https://ideas.ibm.com/

Fri March 24, 2023 04:27 AM

Hi Bhavnit...

Thanks for your wonderful blog and it was very useful. I wanted to create a site map for the API Developer portal site. I could see that it is not available in the default site. Please help in adding the default site map view for developer portal. My requirement is to produce API developer portal site map for UI teams customization. Thanks