Scenarios
To call a service after it is published, you need to create a key-value pair secret and a usage plan and bind them to the service environment.
This document describes how to configure a user-specific usage plan and make it available to the users.
Prerequisite
Directions
Creating a key-value pair secret
1. Log in to the API Gateway console, and click Application on the left sidebar to enter the application management page. 2. On the application management page, click Secret on the top to open the secret management page.
3. Click Create, select the secret type and complete the following information.
Enter the secret name.
Secret name: Up to 50 characters ([a-z], [A-Z], [0-9] and [_])
Enter the secret name, SecretId and SecretKey.
Secret name: Up to 50 characters ([a-z], [A-Z], [0-9] and [_-])
SecretId: 5-50 characters ([a-z], [A-Z], [0-9] and [_-])
SecretKey: 10-50 characters ([a-z], [A-Z], [0-9] and [_-])
4. Click Submit to generate a secret or save the custom key-value pair secret (SecretId and SecretKey).
Creating a usage plan
1. On the left sidebar, click Usage Plan to enter the usage plan list page. 2. Click Create in the top-left corner and enter the configuration information as prompted.
3. Click Submit to complete the creation.
Binding usage plan to secret
1. On the Usage Plan page, click the ID of the target usage plan to enter the usage plan details page. 2. On the usage plan details page, click Bind Key.
3. Check the SecretId
to be bound and click Submit to complete the binding.
Binding a usage plan with a service environment
1. Select a created service on the Service list page, switch to the Usage Plan tab, and click Bind. 2. In the usage plan binding window, select an effective environment and usage plan to be bound.
Effective environments: publish, pre-publish, and testing
3. Click Submit to complete the binding.
Note:
Usage plans bound with the same key-value pair cannot be bound to the same environment.
Now you can share the SecretId and SecretKey to the end user. The end user can use the provided SecretId
and SecretKey
through the second-level domain name of the service (or a bound private domain name) to access the APIs published in the service.
Was this page helpful?