Azure API Management
Configuring Revenium Metering for Azure API Management



Last updated
Was this helpful?
Configuring Revenium Metering for Azure API Management



Last updated
Was this helpful?
Was this helpful?
<policies>
<inbound>
<base />
<send-one-way-request mode="new">
<set-url>https://api.revenium.io/meter/v1/api/event</set-url>
<set-method>POST</set-method>
<set-header name="x-api-key" exists-action="override">
<value>API_KEY_GOES_HERE</value>
</set-header>
<set-header name="content-type" exists-action="override">
<value>application/json</value>
</set-header>
<set-body>@{
return new JObject(
new JProperty("requestId",context.RequestId),
new JProperty("assetId","ASSET_ID_GOES_HERE"),
new JProperty("eventType", "REQUEST"),
new JProperty("url", context.Api.Path),
new JProperty("productKey", context.Request.Headers.GetValueOrDefault("x-revenium-product-key","")),
new JProperty("method", context.Request.Method),
new JProperty("currentMillis", (new DateTimeOffset(DateTime.Now)).ToUnixTimeSeconds() * 1000 )
).ToString();
}</set-body>
</send-one-way-request>
</inbound>
<backend>
<base />
</backend>
<outbound>
<base />
<send-one-way-request mode="new">
<set-url>https://api.revenium.io/meter/v1/api/event</set-url>
<set-method>POST</set-method>
<set-header name="x-api-key" exists-action="override">
<value>API_KEY_GOES_HERE</value>
</set-header>
<set-header name="content-type" exists-action="override">
<value>application/json</value>
</set-header>
<set-body>@{
return new JObject(
new JProperty("requestId",context.RequestId),
new JProperty("assetId","ASSET_ID_GOES_HERE"),
new JProperty("eventType", "RESPONSE"),
new JProperty("responseCode", context.Response.StatusCode),
new JProperty("currentMillis", (new DateTimeOffset(DateTime.Now)).ToUnixTimeSeconds() * 1000 )
).ToString();
}</set-body>
</send-one-way-request>
</outbound>
<on-error>
<base />
</on-error>
</policies>