Updated on 2022-02-21 GMT+08:00

Binding a Request Throttling Policy

Function

The request throttling policy bound to an API will control all access to the API. If the number of API calls within a specified period reaches the limit, subsequent access will be rejected, protecting the backend API from abnormal traffic and ensuring stable service running.

This API is used to bind a request throttling policy to an API that has been published in an environment.

You can bind different request throttling policies to an API in different environments, but can bind only one request throttling policy to the API in each environment.

URI

The following table lists the HTTP/HTTPS request method and URI of the API.

Table 1 HTTP/HTTPS request method and URI

Request Method

URI

POST

/v1.0/apigw/throttle-bindings

Request

Table 2 Parameter description

Parameter

Mandatory

Type

Description

publish_ids

Yes

Array of strings

API publication record ID

strategy_id

Yes

String

ID of a request throttling policy

Example request:

{
  "publish_ids": [
    "374a6d5a-20c7-4ea1-82e1-19fce4556956",
    "65e6fe53-1ac3-4481-ba36-9f0bc6f22057"
  ],
  "strategy_id": "0325b671-2d50-4614-9868-22102262695d"
}

Response

Table 3 Parameter description

Parameter

Type

Description

throttle_applys

Dictionary

Binding list

Table 4 Parameter description of throttle_applys

Parameter

Type

Description

id

String

Binding ID

strategy_id

String

ID of a request throttling policy

publish_id

String

API publication record ID

scope

Integer

Scope of the request throttling policy, which can be:

  • 1: access from users and apps
  • 2: access from a user
  • 3: access from an app

Currently, only 1 is supported.

apply_time

Timestamp

Time when the request throttling policy is bound to the API

Example response:

{
	"throttle_applys": [{
		"id": "507c6a9f-8322-4dc2-8ba5-b4d74e3690d3",
		"strategy_id": "0325b671-2d50-4614-9868-22102262695d",
		"publish_id": "374a6d5a-20c7-4ea1-82e1-19fce4556956",
		"scope": 1,
		"apply_time": "2017-12-29T03:01:11.138456Z"
	},
	{
		"id": "90f05978-06a3-4096-8bea-b5e2fa12b843",
		"strategy_id": "0325b671-2d50-4614-9868-22102262695d",
		"publish_id": "65e6fe53-1ac3-4481-ba36-9f0bc6f22057",
		"scope": 1,
		"apply_time": "2017-12-29T03:01:11.138456Z"
	}]
}

Status Codes

Table 5 Status codes

Status Code

Description

201

Created

400

Bad Request

401

Unauthorized

403

Forbidden

404

Not Found

500

Server Internal Error