API management

更新时间:
复制 MD 格式

With AHAS gateway throttling, you can create API groups and customize the URL path matching rules for each API. AHAS can then apply throttling to these custom API groups.

Create a custom API

Create an API group to which you want to apply throttling.

  1. Log on to the AHAS console.
  2. In the upper-left corner of the AHAS console, select the region where your application is deployed.
  3. In the navigation pane on the left, click Throttling > Gateway Throttling.
  4. Click the target gateway application card to view its monitoring details.
  5. In the navigation pane on the left, select API Management. In the upper-right corner, click the New button.
  6. In the Create Custom API dialog box, enter a name for the API group. The name must be globally unique and cannot be the same as any route ID in the routing configuration file.
  7. Define the URL path matching rules. Select a match pattern and then enter a match string that corresponds to the selected pattern.
    • Match Pattern can be one of the following:
      • Exact: Strictly matches the URL path against the specified match string. For example, /foo matches only the path /foo.
      • Prefix: Matches URL prefixes based on the specified string. The string must follow the Spring Web pattern style. For example, /foo/** matches all URLs that start with /foo/, such as /foo/22.
      • Regular Expression: Matches URLs based on the specified regular expression.
    • Match String: Enter a string that corresponds to the selected match pattern.
  8. Click + New Match Rule to add more URL path matching rules.
  9. Click New to create the custom API.

    The new API appears on the API Management page.

What to do next

After you create an API, you can edit it, delete it, or set throttling rules for it.

  • Edit an API
    1. On the API Management page, find the target API and click Edit in the Actions column.
    2. In the Edit Custom API dialog box, modify or add URL matching rules.
  • Delete an API
    1. On the API Management page, find the target API and click Delete in the Actions column.
    2. In the confirmation message, click OK to delete the API group.
  • Set throttling rules

    For more information, see API throttling rules.