Contents

Popular

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

PropertyDescription

Quota

Specifies the number of request messages that an application is allowed to submit to an API per hour/day/week/month.
Quota Identifier

For the Quota policy to work, each application requires a unique identifier to be presented with each request. The identifier can be customized. It can be any HTTP header, query parameter, form parameter, or message content that is unique to each consumer application.

Weight

Assigns weight to Assignsweightto specific messages to increase/decrease the impact of request messages over other messages. For example, it can consider POST messages twice as "heavy" or expensive as GET messagesasGETmessages.

Distributed optionThis option is used to fetch data from the distributed database (Cassandra). If disabled, it fetches data from the cache memory in the local machine.

Synchronous




 

The Synchronous option gets enabled when the Distributed option is enabled.


Figure 2: Synchronous option that gets enabled on enabling the Distributed option

Synchronous option enabled specifies that the remaining quota value gets updated after every call. This option is suggested when the quota value is a hard limit tonumber of calls that can be made.

Re-sync Interval

The Re-sync Interval option gets enabled when the Synchronous option is disabled.


Figure 3:  Re-sync Interval option that gets enabled on disabling the Synchronous option

This value specifies the time interval the system waits for before rechecking availability of quota for the user.

Advanced

This is the default option, which allows to configure all the properties described in the above table.

...

  • api.product.quota.allowed -The quota of the product corresponding to the client subscription to which the API key belongs.
  • api.developer.id - The ID of the developer to which the API key corresponds to.

So, when a quota policy is added after the Verify API Key policy, the following configuration will make sure that the values are fetched from the corresponding product and developer.

  • Quota:
    • Type: CONTEXT_VARIABLE
    • Variable Name: api.product.quota.allowed
    • Default Value: Having the Verify API Key before the quota policy makes sure that the variable is populated.
  • Quota Identifier:
    • Type: CONTEXT_VARIABLE
    • Variable Name: api.developer.id
    • Default Value: Any value
  • Quota Identifier:
    • Type: PARAMETER
    • Name: weight (The name of the Query Parameter which needs to be used as the identifier)
    • Default Value: 1

Image RemovedImage Added
Figure 8: Quota policy properties with values provided in Example 1

...

  • Quota :
    • Type: COSTANT
    • Default Value: 10/1/hour
  • Quota Identifier:
    • Type: CONTEXT_VARIABLE
    • Variable Name: api.developer.id
    • Default Value: default
  • Weight:
    • Type: COSTANT
    • DefaultValue: 2

Image RemovedImage Added
Figure 10: Quota policy properties with values provided in Example 2

...

It is possible to assign a variable such as as "subscription.weight in " in the properties of the client subscriptions such that the most important subscription is provided the least weight.  Therefore, a product with a quota of 10 requests per hour and with a client whose subscription has weight 1 can send 10 requests per hour, while with a client whose subscription has weight 2 can send only 5 requests per hour.

Note
  • If Type=CONTEXT_VARIABLE in Quota Policy configuration, the variable name (under Properties) mentioned in the Client Subscription should have the same name (sunscription.weight in this example) as provided for the Weight Type in the Quota Policy configuration.
  • if Type=PARAMETER in Quota Policy configuration, variable name mentioned in the Client Subscription should have a prefix in the format as below:

    Code Block
    proxy.request.query.variableName
  • Quota:
    • Type: CONTEXT_VARIABLE
    • Variable Name: api.product.quota.allowed
    • Default Value: 10/1/hour (Setting the quota value to 10 per hour). Having Verify API Key before the quota policy makes sure that the variable is populated.
  • Quota Identifier:
    • Type: CONTEXT_VARIABLE
    • Variable Name: api.developer.id
    • Default Value: default (any value)
  • Weight Identifier:
    • Type: CONTEXT_VARIABLE
    • Name: subscription.weight
    • Default Value: 1.

 

Adaptavist ThemeBuilder EngineAtlassian Confluence