Monetization Programmatic Quotas
Enterprise Feature
Monetization is available as an add-on as part of an enterprise plan. If you would like to purchase this feature, please contact us at sales@zuplo.com or reach out to your account manager.
Most enterprise features can be used in a trial mode for a limited time. Feel free to use enterprise features for development and testing purposes.
When adding monetization to your API, you would usually set the number of meters
a request will consume in the settings of the
Monetization Policy. For
example, the policy below specifies that each request will consume 1 requests
meter and 5 computeUnits
meters.
json
However, in some cases, you may not know up front how many units of a particular
meter will be consumed until after the response is sent. For example, maybe your
backend is responsible for computing the computeUnits
on a request and send
the result in the response in the compute-units
header.
In Zuplo, you can support these dynamic meters by writing a little code. To make
the computeUnits
meter dynamic, first update the policy by setting the
computeUnits
meter to 0
as shown below.
json
Next you can create a
custom code outbound policy that reads
data from the Response (in this case the compute-units
header) and sets the
meter programmatically.
/modules/set-compute-units-outbound.tsts