Skip to main content

Documentation

List Usage Records

Retrieve a list of usage records for a subscription item.

You can filter the list with query parameters.

    • subscription_item

    • ID of the subscription item. String starting with subi_.

Code Samples
    • .NET

      • using System;
        using System.Text.Json;
        
        namespace RapydApiRequestSample
        {
            class Program
            {
                static void Main(string[] args)
                {
                    try
                    {
                        string subscriptionItem = "subi_1b3355f074e60f9db947a1aa763d5c10";
                        int limit = 10;
                        int endingBefore = 1555491809;
                        int startingAfter = 1555491704;
        
                        string result = RapydApiRequestSample.Utilities.MakeRequest("POST", $"/v1/subscription_items/{subscriptionItem}/usage_record_summaries?{limit}&{endingBefore}&{startingAfter}");
                        Console.WriteLine(result);
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine("Error completing request: " + e.Message);
                    }
                }
            }
        }
        
    • JavaScript

      • const makeRequest = require('<path-to-your-utility-file>/utilities').makeRequest;
        
        async function main() {
          try {
            const result = await makeRequest(
              'GET',
              '/v1/subscription_items/subi_1b3355f074e60f9db947a1aa763d5c10/usage_record_summaries?limit=10&ending_before=1555491809&starting_after=1555491704'
            );
        
            console.log(result);
          } catch (error) {
            console.error('Error completing request', error);
          }
        }
    • PHP

      • <?php
        $path = $_SERVER['DOCUMENT_ROOT'];
        $path .= "/<path-to-your-utility-file>/utilities.php";
        include($path);
        
        try {
            $object = make_request('get', '/v1/subscription_items/subi_1b3355f074e60f9db947a1aa763d5c10/usage_record_summaries?limit=10&ending_before=1555491809&starting_after=1555491704');
            var_dump($object);
        } catch(Exception $e) {
            echo "Error: $e";
        }
        ?>
    • Python

      • from pprint import pprint
        
        from utilities import make_request
        
        subscription_item = "subi_1b3355f074e60f9db947a1aa763d5c10"
        response = make_request(method='get',
                                path=f'/v1/subscription_items/{subscription_item}/usage_record_summaries?limit=10&ending_before=1555491809&starting_after=1555491704')
        
        pprint(response)
  • /v1/subscription_items/{subscription_item}/usage_record_summaries

  • List Usage Records

  • curl -X post
    https://sandboxapi.rapyd.net/v1/subscription_items/subi_1b3355f074e60f9db947a1aa763d5c10/usage_record_summaries?limit=10&ending_before=1555491809&starting_after=1555491704
    -H 'access_key: your-access-key-here'
    -H 'Content-Type: application/json'
    -H 'salt: your-random-string-here'
    -H 'signature: your-calculated-signature-here'
    -H 'timestamp: your-unix-timestamp-here'
    
  • {
        "status": {
            "error_code": "",
            "status": "SUCCESS",
            "message": "",
            "response_code": "",
            "operation_id": "27786db2-997b-43a5-aea6-c9d38c350bb5"
        },
        "data": [
            {
                "id": "subiur_071c4e6cf45fc7acc14624c0848f9568",
                "quantity": 100,
                "timestamp": "1555491807",
                "subscription_item": "subi_1b3355f074e60f9db947a1aa763d5c10"
            },
            {
                "id": "subiur_3af940891fb548d16b277b5462363fe3",
                "quantity": 200,
                "timestamp": "1555491806",
                "subscription_item": "subi_1b3355f074e60f9db947a1aa763d5c10"
            }
        ]
    }