LogoLogo
  • User Guide
    • Getting Started
      • Building a Usage-Based Product in Revenium
      • Setting Up & Using API Analytics & Observability
      • Setting Up & Using Product Analytics
      • Sending Data to Revenium's Metering API
      • Key Concepts & Relationships
    • Connect Your Data
      • cURL Commands for Testing
      • Container-Native Metering
      • Kong
        • Kubernetes Installation
      • Salesforce
        • Revenium Unmanaged Package
          • Anypoint API Experience Hub (AEH)
            • Anypoint API Experience Hub Unmanaged Package Post Installation Instructions
          • Anypoint Community Manager (ACM)
            • Anypoint Community Manager Package Post Installation Instructions
        • Revenium Lightning Web Components
          • Add Components to Experience Cloud site
          • Drop-In Storefront
          • Product Card
          • Product Card (Anypoint)
          • Product Checkout
          • Product Details Button
          • Usage History
          • API Access Requester
      • MuleSoft
        • Metering Policy Configuration
        • Offline Metering Policy Configuration
        • Anypoint API & API Group Synchronization
        • Revenium Connector
        • Disable Default Anypoint Community Manager (ACM) Email Notifications
      • Gravitee
      • Istio
      • Envoy
      • AWS API Gateway
      • Python & Django
      • Golang
      • Spring Boot
      • .Net
      • NodeJs
      • Java/JVM
      • Snowflake
      • Azure API Management
      • IBM
      • Custom Integrations Using Metering Beacons
        • JWT Enrichment
      • Offline Metering via Log Parsing
    • Sources
      • Metering Elements
      • Alerts
        • Alert History
    • API Keys
    • Products & Pricing
      • Product Lines
      • Pricing Rules
        • Revenium Scripting Language
          • RSL Reference
        • Execution Logs
      • SLA Definitions
      • SLA Violation Review
    • Customers
      • Customers
      • Subscribers
      • Subscriptions
      • Subscribers Credentials
      • Subscribers Notifications
    • Billing and Invoicing
      • Manage Refunds
    • Analytics
      • Revenue Analytics
      • Product Analytics
        • Custom Reports (Products)
      • Subscriber Analytics
        • New Subscribers
        • (Daily/Weekly/Monthly) Active Subscribers
        • Most Engaged Subscribers & Customers
        • Historical Usage
      • API Analytics
        • Performance & Availability
        • Compare Periods
        • Traffic by Geography
        • Advanced Search
        • Custom Reports
    • Profile
      • Profile
      • Revenium API Documentation
    • Settings
      • Revenium Users & Organizations
        • Access Permissions by User Type
      • Revenium Subscription
      • Revenium Organizations
      • Notification Templates
      • Transactions Logs
        • Analytics Transaction Log
        • Product Transaction Log
        • Subscription Audit Log
        • No Code Transaction Testing
      • Integrations
        • Data Sync
        • Export Configurations
        • Notification Providers
        • Payment Configurations
          • Customer VAT ID Support
        • ERP Configurations
        • External Integration Logs
        • Identity Providers
      • System Logs
      • Default Configuration Limits
Powered by GitBook

© Revenium - www.revenium.io

On this page
  1. User Guide
  2. Connect Your Data

Azure API Management

Configuring Revenium Metering for Azure API Management

Last updated 9 months ago

Sending API transaction metadata to Revenium Metering Beacons is configured on Azure API Management using Inbound and Outbound processing policies. To configure these navigate to the Policy configuration for the API you want to monetize as follows:

Click on the code editor to enter the XML policy configuration:

Add the following XML configuration and replace the following values:

REVENIUM_METERING_BEACON_KEY

The Metering Beacon API Key provided by the Revenium Team

REVENIUM_ASSET_ID

The Sources ID Obtained from the Revenium Application

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

The Revenium Source ID can be obtained from the Sources page: