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.
|
Request Method |
URI |
|---|---|
|
POST |
/v1/{project_id}/apigw/instances/{instance_id}/throttle-bindings |
The following table lists the parameters in the URI.
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
project_id |
Yes |
String |
Project ID, which can be obtained by the administrator on the My Credentials page. |
|
instance_id |
Yes |
String |
Instance ID, which can be obtained from the dedicated gateway information on the API Gateway console. |
Request
|
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
|
Parameter |
Type |
Description |
|---|---|---|
|
throttle_applys |
Dictionary |
Binding list |
|
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:
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
|
Status Code |
Description |
|---|---|
|
201 |
Created |
|
400 |
Bad Request |
|
401 |
Unauthorized |
|
403 |
Forbidden |
|
404 |
Not Found |
|
500 |
Server Internal Error |
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.