Using the site-config commands

You can use the site-config commands to create exports and imports, delete exports and imports, get the status of an export or import, and get an export, on your Developer Portal service.

  1. Log in as Provider org:
    apic login --server management_server --realm provider/identity_provider --username cloud_username --password cloud_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: Cloud Manager 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 site configs.
    The site-config: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 site-config:get-export-status and site-config:get-export to get the status and potentially an artifact.
    apic --mode portaladmin site-config:create-export --catalog name/id --org orgid/name --server management_server
    • The site config .tgz is saved to the directory in which you ran the command.
    • The saved .tgz has the format site_config_createExport-20200217134637.tgz.
    • You can save your exports into your change control management system.
    For example,
    apic --mode portaladmin site-config:create-export --catalog dev --org ibm --server api.stagingexample.com
  3. Import your site configs.
    The site-config:create-import command uses the supplied .tgz file to import the site configs 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.
    Note: The command continues to poll until the maximum polling time of 15 minutes is reached. At which point you can use the command site-config:get-import-status to get the status of the import.
    apic --mode portaladmin site-config:create-import --catalog name/id --org orgid/name --server management_server /PATH/TO/SITE_CONFIG/TGZ
    For example,
    apic --mode portaladmin site-config:create-import --catalog prod --org ibm --server api.productionexample.com C:/users/example/desktop/site_config_createExport-20200217134637.tgz
  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.
    For example,
    apic --mode portaladmin site-config:delete-export --catalog name/id --org orgid/name --server management_server --format json --task_id string
    apic --mode portaladmin site-config:delete-import --catalog name/id --org orgid/name --server management_server --format json --task_id string