How to enable and disable maintenance mode on your Developer Portal
You can use the Portal commands in the toolkit CLI to enable and disable maintenance mode on your Developer Portal site.
Before you begin
To complete this Portal CLI scenario, you must have a Developer Portal
enabled. You must also have administrator access to this site, and the permission
settings:manage, to complete this scenario. The tutorial Creating the Portal explains how to enable the
portal if you haven't enabled it already.
For more information about using the toolkit CLI with the Developer Portal, see Getting started with the Portal CLI commands.
About this scenario
In this scenario, you use the toolkit CLI to enable, and then disable, maintenance mode on your Developer Portal site.
Log in to the management server as a Provider organization by using the toolkit CLI
- Log in to the toolkit CLI as a Provider org:
apic login --server management_server --realm provider/identity_provider --username provider_username --password provider_passwordYou can determine which identity provider to use in the--realmparameter 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):
For example,apic identity-providers:list --scope provider --server mgmt_endpoint_url --fields title,realm
Theapic 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-ldaptitlevalue should enable you to determine which identity provider to use; you can then copy the corresponding--realmparameter directly from the displayedrealmvalue. 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 isdefault-idp-2.For full details of the
apic logincommand, see Logging in to a management server.
Use the toolkit CLI to enable maintenance mode
- Run the following command to enable maintenance mode on your Developer Portal:
Where:apic --mode portaladmin drupal-state:set --server management_server --org orgid/name --catalog catalogid/name --state_key system.maintenance_mode --input_format integer --state_value 1management_serveris the endpoint URL of your management server (required).catalogid/nameis the ID or name of the catalog that your site belongs to (required).orgid/nameis the ID or name of the provider organization that the catalog belongs to (required).--state_keyis the name of the state key (required). Must be set tosystem.maintenance_mode.--input_formatis the input format of the value of the state key. Must be set tointegerfor configuring the maintenance mode.--state_valueis the value to assign to the state key (required). Set to1to enable maintenance mode.
For example, to enable maintenance mode for a Developer Portal in themyOrgorganization, and in thedevcatalog:apic --mode portaladmin drupal-state:set --server my.management.server.com --org myOrg --catalog dev --state_key system.maintenance_mode --input_format integer --state_value 1 Successfully set state system.maintenance_mode to the value of 1.The Developer Portal site is now inaccessible to everyone apart from an administrator. All other users who enter the site URL will see a maintenance message set by the administrator.
Use the toolkit CLI to disable maintenance mode
- Run the following command to disable maintenance mode on your Developer Portal:
Where:apic --mode portaladmin drupal-state:set --server management_server --org orgid/name --catalog catalogid/name --state_key system.maintenance_mode --input_format integer --state_value 0management_serveris the endpoint URL of your management server (required).catalogid/nameis the ID or name of the catalog that your site belongs to (required).orgid/nameis the ID or name of the provider organization that the catalog belongs to (required).--state_keyis the name of the state key (required). Must be set tosystem.maintenance_mode.--input_formatis the input format of the value of the state key. Must be set tointegerfor configuring the maintenance mode.--state_valueis the value to assign to the state key (required). Set to0to disable maintenance mode.
For example, to disable maintenance mode for a Developer Portal in themyOrgorganization, and in thedevcatalog:apic --mode portaladmin drupal-state:set --server my.management.server.com --org myOrg --catalog dev --state_key system.maintenance_mode --input_format integer --state_value 0 Successfully set state system.maintenance_mode to the value of 0.Your Developer Portal site is now accessible to everyone again.
What you did in this scenario
In this scenario, you used the toolkit CLI to put your Developer Portal site into maintenance mode, and to turn maintenance mode off again.