cURL Commands for Testing
Below are instructions & sample code explaining how to use Revenium's metering API to receive transactions from your application.
If you are not using one of Revenium's gateway integration plugins, Revenium's metering API (documentation link) allows you to send data directly to Revenium from your application, and the code below will give you a quick start guide on using the API to send transactional data to Revenium.
Revenium's metering API can be used in two ways: The first is for API observability and analytics (without monetization), and the second is to utilize both the monetization & observability functions.
The process & pre-requisites for sending transactions in each scenario is provided below.
API Observability (no monetization)
Pre-requisites before using sample code below:
Obtain your API key from the API Keys page in the application and insert it where indicated in the code block below. If you need to create a new key, you can do it via the API Integrations Keys page.
Advanced Analytics & API Monetization
Pre-requisites before using sample code below.
Create an API Source in Revenium, or use an auto-detected API source that was created from your previous traffic.
Create an API Product in Revenium and assign the source you created to the product you just created.
For monetization use cases, API Products group together Sources into sellable bundles and assign a pricing plan to the bundle.
For productization & advanced API analytics, products are used in conjunction with Subscriptions & Subscriber Credentials (steps 3 & 4) to link API subscribers to your APIs.\
Create a Subscription in Revenium for the Product you created in step 2.
Subscriptions are used to grant individual end subscribers a right to access your product and to meter usage of the product so that an invoice can be generated at the end of each settlement period.\
Create or select & edit a pre-existing Subscribers Credential in Revenium with the following options:
Select the Subscription you just created while configuring the Application,
Assign an arbitrary "External API Key" in that Application (in practice, this "External API Key" will be the identifier used by your Subscribers' applications to access your API, but for testing, we can use an arbitrary value)
Note that multiple Applications can share the same Subscription, which allows you to share a single subscription among a number of different end subscriber or applications from a given customer who may want to measure consumption individually for each application, but pay for all combined usage on a single invoice.
The External API Key of the Application is required so that Revenium can easily associate client application usage to a valid Subscription without requiring a separate credential to be provided to Revenium in the headers of the end subscriber's API call.
Access your API key from the API Integrations Keys page
Use the information from steps 1-5 and insert it where indicated in the "Complex cURL Example" code block below.
Sample cURL Commands
Note that you have to remove all of the # symbols and any text after the hash symbols in the sample code block before sending the cURL request. Lines that only contain a hash symbol should be completely removed before sending your request.
Viewing Test Transaction Data in Revenium
Once you have sent test transactions using the code above, after approximately two minutes, you will see a record of these transactions in the Analytics Transaction Log. Productized transactions will also generate additional logging data in the Product Transaction Log.
Be aware that API Product Transactions are only metered for requests with a 200 series response code. This is to prevent charging your subscribers for transactions that do not complete successfully in API monetization use cases. Basic API analytics will be captured in the Analytics Transaction Log regardless of the response code.
Troubleshooting
If you do not see evidence of your logged transactions after 5 minutes, you can look for errors in the System Logs to help troubleshoot why your traffic is not being properly received.
Additional Integration Options
Additional custom integration options are explained in the following section.
Last updated