Was this Helpful?

 Reset Quota policy

About | Samples | Element reference | Error codes | Schemas | Related topics

What

Use to dynamically reset the limit for a specified Quota policy. For example, use this policy to reset a developer's quota counter when she purchases additional API calls.

Where

This policy can be attached in the following locations.

ProxyEndpoint TargetEndpoint
    PreFlow Flow PostFlow PreFlow Flow PostFlow    
Request    
    Response
    PostFlow Flow PreFlow PostFlow Flow PreFlow    

Samples

These policy code samples illustrate how to reset quota counters by:

<ResetQuota name="resetQuota">
   <Quota name="request.header.quotapolicy">
      <Identifier name="_default">
         <Allow>100</Allow>
      </Identifier>
   </Quota>
</ResetQuota>
<ResetQuota name="resetQuota">
   <Quota name="request.header.quotapolicy">
      <Identifier name="_default">
         <Allow ref="request.header.allowquota" />
      </Identifier>
   </Quota>
</ResetQuota>
<ResetQuota name="resetQuota">
   <Quota ref="request.header.quotapolicy">
      <Identifier ref="request.header.identifier">
         <Allow>100</Allow>
      </Identifier>
   </Quota>
</ResetQuota>
<ResetQuota name="resetQuota">
   <Quota name="quotapolicy">
      <Identifier name="_default">
         <Class ref="request.header.classIdentifier" />
         <Allow>200</Allow>
      </Identifier>
   </Quota>
</ResetQuota>

Element reference

The element reference describes the elements and attributes of the ResetQuota policy.

<ResetQuota async="false" continueOnError="false" enabled="true" name="Reset-Quota-1">
   <DisplayName>Reset Quota 1</DisplayName>
   <Quota name="quotaName">
      <Identifier name="identifierName" ref="request.header.identifier">
         <Allow>100</Allow>
      </Identifier>
   </Quota>
</ResetQuota>

<ResetQuota> attributes

<ResetQuota async="false" continueOnError="false" enabled="true" name="Reset-Quota-1">
Attribute Description Default Presence
async

Set to true to specify that the policy should be run in a thread pool different from the pool servicing the request/response flow.

Note: This setting is only used for for internal optimization. Contact Apigee Support via the Support Portal for more information.

false Optional
continueOnError

Set to false to return an error when a policy fails. This is expected behavior for most policies. For example, when a quota is exceeded, an error will be raised.

Set to true to have flow execution continue even after a policy fails.

false Optional
enabled

Set to true to enforce the policy.

Set to false to "turn off" the policy. The policy will not be enforced even if it remains attached to a flow.

true Optional
name

The internal name of the policy. Characters you can use in the name are restricted to: A-Z0-9._\-$ %. However, the Edge management UI enforces additional restrictions, such as automatically removing characters that are not alphanumeric.

Optionally, use the <DisplayName> element to label the policy in the management UI proxy editor with a different, natural-language name.

N/A Required

<DisplayName> element

Use in addition to the name attribute to label the policy in the management UI proxy editor with a different, natural-language name.

<DisplayName>ResetQuotaforWaller</DisplayName>
Default: N/A
Presence: Optional
Type: String

<Quota> element

Identifies the Quota policy whose counter should be reset.

<Quota name="quotaName">
   <Identifier name="identifierName" ref="request.header.identifier">
      <Allow>100</Allow>
   </Identifier>
</Quota>
Default: N/A
Presence: Required
Type: N/A

Attributes

Attribute Description Default Presence
name

Specifies the name of the Quota policy whose counter should be reset.

N/A Optional
ref

Reference that assigns a value to the variable.

N/A Optional

<Quota>/<Identifier> element

Variable used to uniquely identify the client. For example, client_id.

<Quota name="quotaName">
   <Identifier name="identifierName" ref="request.header.identifier">>
      <Allow>100</Allow>
   </Identifier>
</Quota>
Default: N/A
Presence: Optional
Type: String

Attributes

Attribute Description Default Presence
name

Specifies the name of the client for which the Quota policy whose counter should be reset.

N/A Optional
ref

Reference that assigns a value to the variable.

N/A Optional

<Quota>/<Identifier>/<Class> element

Specifies the class for which the Quota counter will be reset.

<Identifier name="_default">
   <Class ref="request.header.classIdentifier" />
   <Allow>200</Allow>
</Identifier>
Default: N/A
Presence: Optional
Type: N/A

Attributes

Attribute Description Default Presence
name

Specifies the class for which the Quota policy whose counter should be reset.

N/A Optional
ref

Reference that assigns a value to the variable.

N/A Optional

<Quota>/<Identifier>/<Allow> element

Specifies the message count to which the Quota counter will be reset.

<Identifier name="identifierName" ref="request.header.identifier">
   <Allow>100</Allow>
</Identifier>
Default: N/A
Presence: Optional
Type: Integer

Error codes

The default format for error codes returned by policies is:

{
  "code" : " {ErrorCode} ",
  "message" : " {Error message} ",
  "contexts" : [ ]
}
Error Code Message
InvalidRLPolicyDefinition Invalid rate limit policy {0}
NoRLPolicy Quota policy {0} is not attached.
InvalidCount Invalid count value {0} for identifier {1} in {2}
FailedToResolveAllowCountRef Failed to resolve allow count reference {0} for identifier {1} in {2}

Schemas

See our Github repository samples for the most recent schemas.

Related topics

Quota policy

Help or comments?

  • Something's not working: See Apigee Support
  • Something's wrong with the docs: Click Send Feedback in the lower right.
    (Incorrect? Unclear? Broken link? Typo?)