Using the custom-theme commands

You can use the custom-theme commands to create export and import tasks, delete export and import tasks, get the status of an export or import task, and get an export artifact, on your Developer Portal service.

  1. Log in as Provider org:
    apic login --server management_server --realm provider/identity_provider --username provider_username --password provider_password
    You can determine which identity provider to use in the --realm parameter by entering the following command to see a list of all available identity providers (you do not need to be logged in to use this command):
    apic identity-providers:list --scope provider --server mgmt_endpoint_url --fields title,realm
    For example,
    apic identity-providers:list --scope provider --server myserver.com --fields title,realm 
    total_results: 2
    results:
      - title: API Manager Local User Registry
        realm: provider/default-idp-2
      - title: Corporate LDAP user registry
        realm: provider/corporate-ldap
    The title value should enable you to determine which identity provider to use; you can then copy the corresponding --realm parameter directly from the displayed realm value. For any identity providers that were created by your administrator after API Connect was installed, the names will have been determined at creation time. The default API Manager Local User Registry for login as a member of a provider organization is default-idp-2.

    For full details of the apic login command, see Logging in to a management server.

  2. Export your custom themes.
    The custom-theme:create-export command creates an export task against the portal of the specified catalog and org. The command then polls the status of the task until it has FINISHED and the artifacts are streamed back.
    Note: The command continues to poll until the maximum polling time of 15 minutes is reached. At which point you can use the commands custom-theme:get-export-status and custom-theme:get-export to get the status and potentially an artifact.
    apic --mode portaladmin custom-theme:create-export --catalog name/id --org orgid/name --server management_server
    • The theme .tgz is saved to the directory in which you ran the command.
    • The saved .tgz has the format custom_theme_createExport-20200217134637.tgz.
    • You can save your exports into your change control management system.
    For example,
    apic --mode portaladmin custom-theme:create-export --catalog dev --org ibm --server api.stagingexample.com
  3. Import your custom themes.
    The custom-theme:create-import command uses the supplied .tgz file to import the custom themes into the portal of the specified catalog and org. The command then polls the status of the task until the task has either FINISHED successfully, or failed because of an error.
    Note:
    • The higher level folders of the archive can contain only these characters, a-z and 0-9.
    • The command continues to poll until the maximum polling time of 15 minutes is reached. At which point you can use the command custom-theme:get-import-status to get the status of the import.
    • If you import a custom theme that already exists you overwrite the existing custom theme.
    • The Drupal cache is rebuilt in the background after the task is complete. If you want to include the cache rebuild as part of the task, you must include the --wait flag.
    apic --mode portaladmin custom-theme:create-import --catalog name/id --org orgid/name --server management_server /PATH/TO/theme/TGZ --wait
    Where --wait is an optional flag that makes the Drupal cache rebuild part of the task. Otherwise, the cache is rebuilt in the background after the task is finished.
    For example,
    apic --mode portaladmin custom-theme:create-import --catalog prod --org ibm --server api.productionexample.com C:/users/example/desktop/custom_theme_export_three.tgz
    Loading File (Large files may take a while)...
    
    201 CREATED - Task ID: lpzqgmoyh4hps7uq
    
    Response Code - 202:
    
    Message(s) -
    The status of this task is: QUEUED
    
    Response Code - 202:
    
    Message(s) -
    The status of this task is: RUNNING
    
    Response Code - 200:
    
    Message(s) -
    2024-01-10 15:27:22: CLI task (custom_theme:import) starting.
    2024-01-10 15:27:25: Deleting existing custom theme /var/aegir/platforms/devportal-10.x-10.99.99.99-20240109-0956/sites/api.productionexample.com/themes/emerald_theme_css
    2024-01-10 15:27:25: Importing custom theme emerald_theme_css
    2024-01-10 15:27:26: Deleting existing custom theme /var/aegir/platforms/devportal-10.x-10.99.99.99-20240109-0956/sites/api.productionexample.com/themes/ruby_theme_scss
    2024-01-10 15:27:26: Importing custom theme ruby_theme_scss
    2024-01-10 15:27:26: Deleting existing custom theme /var/aegir/platforms/devportal-10.x-10.99.99.99-20240109-0956/sites/api.productionexample.com/themes/sapphire_theme_css
    2024-01-10 15:27:26: Importing custom theme sapphire_theme_css
    2024-01-10 15:27:35: The Drupal cache will now be rebuilt. If you experience issues, please attempt to rebuild the cache via CLI.
    2024-01-10 15:27:35: CLI task (custom_theme:import) completed successfully.
  4. You can run the delete command to cancel any ongoing or recently created import or export tasks. Any temporarily created artifacts will be deleted from the portal filesystem. No custom themes are deleted.
    For example,
    apic --mode portaladmin custom-theme:delete-export --catalog name/id --org orgid/name --server management_server --format json --task_id string
    apic --mode portaladmin custom-theme:delete-import --catalog name/id --org orgid/name --server management_server --format json --task_id string