Binding a Request Throttling Policy
Function
The request throttling policy bound to an API will control access of all users 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
POST /v2/{project_id}/apic/instances/{instance_id}/throttle-bindings
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Project ID. For details about how to obtain the project ID, see Appendix > Obtaining a Project ID in the ROMA Connect API Reference. |
instance_id |
Yes |
String |
Instance ID. |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
X-Auth-Token |
Yes |
String |
User token, which can be obtained by calling the IAM API (value of X-Subject-Token in the response header). |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
strategy_id |
Yes |
String |
Request throttling policy ID. Minimum: 1 Maximum: 65 |
publish_ids |
Yes |
Array of strings |
API publication record ID. |
Response Parameters
Status code: 201
Parameter |
Type |
Description |
---|---|---|
throttle_applys |
Array of ThrottleApiBinding objects |
List of binding relationships between APIs and request throttling policies. |
Parameter |
Type |
Description |
---|---|---|
publish_id |
String |
API publication record ID. |
scope |
Integer |
Scope of the request throttling policy.
Currently, only 1 is supported. |
strategy_id |
String |
Request throttling policy ID. |
apply_time |
String |
Time when the policy is bound to the API. |
id |
String |
Binding record ID. |
Status code: 401
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. |
error_msg |
String |
Error description. |
Status code: 403
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. |
error_msg |
String |
Error description. |
Status code: 404
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. |
error_msg |
String |
Error description. |
Status code: 500
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. |
error_msg |
String |
Error description. |
Example Requests
{ "publish_ids" : [ "40e7162dc6b94bbbbb1a60d2a24b1b0c" ], "strategy_id" : "3437448ad06f4e0c91a224183116e965" }
Example Responses
Status code: 201
Created
{ "throttle_applys" : [ { "publish_id" : "40e7162dc6b94bbbbb1a60d2a24b1b0c", "scope" : 1, "strategy_id" : "3437448ad06f4e0c91a224183116e965", "apply_time" : "2020-08-03T12:25:52.257613934Z", "id" : "3e06ac135e18477e918060d3c59d6f6a" } ] }
Status code: 401
Unauthorized
{ "error_code" : "APIG.1002", "error_msg" : "Incorrect token or token resolution failed" }
Status code: 403
Forbidden
{ "error_code" : "APIG.1005", "error_msg" : "No permissions to request this method" }
Status code: 404
Not Found
{ "error_code" : "APIG.3005", "error_msg" : "Request throttling policy 3437448ad06f4e0c91a224183116e965 does not exist" }
Status code: 500
Internal Server Error
{ "error_code" : "APIG.9999", "error_msg" : "System error" }
Status Codes
Status Code |
Description |
---|---|
201 |
Created |
401 |
Unauthorized |
403 |
Forbidden |
404 |
Not Found |
500 |
Internal Server Error |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot