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
  • Setting up a TLS Client Profile
  • Configuring a Multi-Protocol Gateway Processing Policy
  1. User Guide
  2. Connect Your Data

IBM

Configuring Revenium Metering for IBM DataPower

Last updated 9 months ago

APIs being proxied by IBM DataPower instances can be metered by Revenium using a simple GatewayScript configured in a Multi-Protocol Gateway Service as part of a Processing Policy.

Setting up a TLS Client Profile

A TLS Client Profile must be configured for the GatewayScript to communicate with the Revenium Platform API. Start by navigating to Objects -> Crypto Configuration -> Configure TLS Client Profile and create a Client Profile called "revenium-metering":

Configuring a Multi-Protocol Gateway Processing Policy

Navigate to Multi-Protocol Gateway and either create or select an existing Multi-Protocol Gateway:

Select an existing or create a new Processing Policy.

Add a GatewayScript Action as a new Rule and set the Rule Direction to "Both Directions"

Edit the following GatewayScript and replace the "sourceId" with the ID of the Revenium Source that will be metered with DataPower. Also replace the "x-api-key" field with the Revenium Metering Beacon API Key. Please contact the Revenium Customer Success team if you require an API key.

The sourceId will become an optional field in an upcoming release

var urlopen = require('urlopen');
var hm = require('header-metadata');
var sm = require('service-metadata');

var reveniumURL = "https://api.hypercurrent.io/meter/v1/api/event"
var apiKey = "hak_1234"
var assetId = "lkpkW3:7d877eb7-19df-4b4c-8500-2958a4b1c734"
var sslClientProfile = "revenium-metering"

var ctx = session.name('revenium') || session.createContext('revenium');

if (ctx.getVariable("requestId")) {
    var payload = {
        "requestId": ctx.getVariable("requestId"),
        "eventType": "RESPONSE",
        "currentMillis": Date.now()
    }

    var options = {
        target: reveniumURL,
        sslClientProfile: sslClientProfile,
        method: 'post',
        headers: {'x-api-key': apiKey},
        contentType: 'application/json',
        timeout: 60,
        data: JSON.stringify(payload)
    };

    urlopen.open(options, function (error, response) {
        response.disconnect()
    });

} else {

    ctx.setVariable("requestId", sm.getVar("var://service/global-transaction-id"));

    var payload = {
        "requestId": ctx.getVariable("requestId"),
        "eventType": "REQUEST",
        "assetId": assetId,
        "productKey": hm.current.get("x-revenium-product-key"),
        "uri": sm.getVar("var://service/URL-in"),
        "method": sm.protocolMethod,
        "currentMillis": Date.now()
    }

    var options = {
        target: reveniumURL,
        sslClientProfile: sslClientProfile,
        method: 'post',
        headers: {'x-api-key': apiKey},
        contentType: 'application/json',
        timeout: 60,
        data: JSON.stringify(payload)
    };

    urlopen.open(options, function (error, response) {
        response.disconnect()
    });
}

Finally, upload the script and apply the Policy. Once this is done, this API is successfully set up for Revenium metering.

Configuring a TLS Client Profile
Select Multi-Protocol Gateway
Select an existing or create a new Multi-Protocol Gateway
Select an existing or create a new Processing Policy
Add a GatewayScript Action as a new Rule