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

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 asGETmessages.

Note
titleImplications to the Variable name in Client Subscription Properties
  • if Type=PARAMETER, the variable name to be mentioned in the Client Subscription should be specified with a prefix as below:

    Code Block
    proxy.request.query.<Name as provided for PARAMETER>
    Tip

    Refer to Example 1 which illustrates this.

  • If Type=CONTEXT_VARIABLE, the variable name to be mentioned in the Client Subscription should be the name as provided for CONTEXT_VARIABLE.

    Tip

    Refer to Example 3 which illustrates this.

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




 

Specifies that the remaining quota value gets updated after every call. This option is suggested when the quota value is a hard limit to the number of calls that can be made.

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


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

Re-sync Interval

Specifies the time that the system waits for before rechecking the availability of quota for the user.

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 is the default option, which allows to configure configuring all the properties described in the above table.

Click the Edit  button corresponding to the Quota, Quota Identifier, or Weight to configure Type, Variable Name, and Default Value.
Image Modified
Figure 4: Dialog box to choose Identifier Type

...

With this option selected, it assumes the quota as configured in the Product Configuration for which the weight can be configured additionally.

Image Modified
Figure 6: Weight property to configure in the "Fetch from product corresponding to developer ID" option

Image Modified
Figure 7: Quota property values configured in the Product Configuration screen

...

  • 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 IdentifierWeight:
    • Type: PARAMETER
    • Name: weight (The name of the Query Parameter which needs to be used as the identifier) 

      Info

      As Type is "PARAMETER", the variable name mentioned in the Client Subscription should be specified as below:

      Code Block
      proxy.request.query.weight

      Image Added
      Figure 8: Client Subscription Property variable name provided as the Weight variable name with prefix for variable type - PARAMETER

    • Default Value: 1


Figure 89: Quota policy properties with values provided in Example 1

This policy restricts the number of requests to 10 per hour for the project. If the number of requests exceeds the limit, then an error message appears such as the one below:


Figure 910: Error message that appears when the requests exceed the set limit

...

  • 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


Figure 1011: Quota policy properties with values provided in Example 2

...

As explained in Example 1, when a project has both Verify API Key/Verify access token and Quota policies configured, the details about the product, client, and client subscription will be populated automatically.  Consider the client subscription below.


Figure 1112: Quota policy properties with values provided in Example 3

It is possible to assign a variable such as "subscription.weight" 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.

...

  • Quota

...

  • :
      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 

          Info

          As Type is "CONTEXT_VARIABLE", the variable name mentioned in the Client Subscription (under Properties) is provided with the same name (subscription.weight) as displayed in the figure above.

        • Default Value: 1.

       

    Adaptavist ThemeBuilder EngineAtlassian Confluence