Subscription Policies (Collection)


Get all Subscription level throttle policies
GET https://apis.wso2.com/api/am/admin/v0.12/throttling/policies/subscription

This operation can be used to retrieve all Subscription level throttle policies.

OAuth 2.0 Scope

apim:tier_viewi

Request

GET https://localhost:9443/api/am/admin/v0.12/throttling/policies/subscription Authorization: Bearer 0d63e133-7ad6-3aeb-9ca9-9299e0708122

Response

HTTP/1.1 200 OK Content-Type: application/json { "count": 5, "list": [ { "policyId": "6fac9345-6e49-4a31-813b-3d520e09e38b", "policyName": "Gold", "displayName": "Gold", "description": "Allows 5000 requests per minute", "isDeployed": true, "defaultLimit": { "type": "RequestCountLimit", "timeUnit": "min", "unitTime": 1, "requestCount": 5000 }, "rateLimitCount": 0, "rateLimitTimeUnit": null, "customAttributes": [], "stopOnQuotaReach": true, "billingPlan": "FREE" }, { "policyId": "851bf1b4-19da-4019-949a-9b371f53c8d6", "policyName": "Silver", "displayName": "Silver", "description": "Allows 2000 requests per minute", "isDeployed": true, "defaultLimit": { "type": "RequestCountLimit", "timeUnit": "min", "unitTime": 1, "requestCount": 2000 }, "rateLimitCount": 0, "rateLimitTimeUnit": null, "customAttributes": [], "stopOnQuotaReach": true, "billingPlan": "FREE" }, { "policyId": "f0b88e6e-cb02-46d6-9c7c-6204729b39f2", "policyName": "Bronze", "displayName": "Bronze", "description": "Allows 1000 requests per minute", "isDeployed": true, "defaultLimit": { "type": "RequestCountLimit", "timeUnit": "min", "unitTime": 1, "requestCount": 1000 }, "rateLimitCount": 0, "rateLimitTimeUnit": null, "customAttributes": [], "stopOnQuotaReach": true, "billingPlan": "FREE" }, { "policyId": "880bd267-4b14-4248-ac35-37c52546851f", "policyName": "Unauthenticated", "displayName": "Unauthenticated", "description": "Allows 500 request(s) per minute", "isDeployed": true, "defaultLimit": { "type": "RequestCountLimit", "timeUnit": "min", "unitTime": 1, "requestCount": 500 }, "rateLimitCount": 0, "rateLimitTimeUnit": null, "customAttributes": [], "stopOnQuotaReach": true, "billingPlan": "FREE" }, { "policyId": "c61f9682-a5f5-4991-b8f9-ea0f44147a5a", "policyName": "Unlimited", "displayName": "Unlimited", "description": "Allows unlimited requests", "isDeployed": true, "defaultLimit": { "type": "RequestCountLimit", "timeUnit": "min", "unitTime": 1, "requestCount": 2147483647 }, "rateLimitCount": 0, "rateLimitTimeUnit": null, "customAttributes": [], "stopOnQuotaReach": true, "billingPlan": "FREE" } ] }

Sample CURL

curl -k -H "Authorization: Bearer 0d63e133-7ad6-3aeb-9ca9-9299e0708122" https://localhost:9443/api/am/admin/v0.12/throttling/policies/subscription

Parameters

Type Name Description Schema Default
Header

Accept

optional

Media types acceptable for the response. Default is application/json.

String

application/json

Header

If-None-Match

optional

Validator for conditional requests; based on the ETag of the formerly retrieved variant of the resourec.

String

Header

If-Modified-Since

optional

Validator for conditional requests; based on Last Modified header of the formerly retrieved variant of the resource.

String

Responses

HTTP Code Description Schema

200

OK. Policies returned

SubscriptionThrottlePolicyList

304

Not Modified. Empty body because the client has already the latest version of the requested resource (Will be supported in future).

406

Not Acceptable. The requested media type is not supported.

Error

Add a Subscription level throttle policy
POST https://apis.wso2.com/api/am/admin/v0.12/throttling/policies/subscription

This operation can be used to add a Subscription level throttle policy specifying the details of the policy in the payload.

OAuth 2.0 Scope

apim:tier_managei

Request

POST https://localhost:9443/api/am/admin/v0.12/throttling/policies/subscription Authorization: Bearer 0d63e133-7ad6-3aeb-9ca9-9299e0708122 Content-Type: application/json { "policyName": "Platinum", "displayName": "Platinum", "description": "Allows 4000 requests per minute", "defaultLimit": { "type": "RequestCountLimit", "timeUnit": "min", "unitTime": 1, "requestCount": 4000 }, "rateLimitCount": -1, "rateLimitTimeUnit": "NA", "customAttributes": [ { "name": "attr1", "value": "123" }, { "name": "attr2", "value": "12" } ], "stopOnQuotaReach": true, "billingPlan": "COMMERCIAL" }

Response

HTTP/1.1 201 Created Location: https://localhost:9443/api/am/admin/v0.12/throttling/policies/subscription/6dd9fc11-bbe1-4daf-aee5-06a4d0e44476 Content-Type: application/json { "policyId": "6dd9fc11-bbe1-4daf-aee5-06a4d0e44476", "policyName": "Platinum", "displayName": "Platinum", "description": "Allows 4000 requests per minute", "isDeployed": true, "defaultLimit": { "type": "RequestCountLimit", "timeUnit": "min", "unitTime": 1, "requestCount": 4000 }, "rateLimitCount": -1, "rateLimitTimeUnit": "NA", "customAttributes": [ { "name": "attr1", "value": "123" }, { "name": "attr2", "value": "12" } ], "stopOnQuotaReach": true, "billingPlan": "COMMERCIAL" }

Sample CURL

curl -k -X POST -H "Authorization: Bearer 0d63e133-7ad6-3aeb-9ca9-9299e0708122" -H "Content-Type: application/json" https://localhost:9443/api/am/admin/v0.12/throttling/policies/subscription -d @data.json

Parameters

Type Name Description Schema Default
Body

body

required

Subscripion level policy object that should to be added

SubscriptionThrottlePolicy (SubscriptionThrottlePolicy)

Header

Content-Type

required

Media type of the entity in the body. Default is application/json.

String

application/json

Responses

HTTP Code Description Schema

201

Created. Successful response with the newly created object as entity in the body. Location header contains URL of newly created entity.

SubscriptionThrottlePolicy

400

Bad Request. Invalid request or validation error

Error

415

Unsupported media type. The entity of the request was in a not supported format.