Usage Report
  • 10 Oct 2024
  • 5 Minutes to read
  • Dark
    Light
  • PDF

Usage Report

  • Dark
    Light
  • PDF

Article summary

Java SDK.NET SDKREST API

Java SDK

To download the full code sample see our Code Share site.

The Usage Report displays, for each sender, the number of packages that are in each possible state (for example, DRAFT, SENT, COMPLETED).

Retrieving a Usage Report

You can retrieve the Usage Report by using the OneSpan Sign ReportService. You will need the date range you want to retrieve.

// Download the usage report for the specified date range
UsageReport report = client.getReportService().downloadUsageReport(from, to);

Sender Usage Reports are returned to you as a list. You will need to loop through each individual sender usage report. To do so, an iterator is used to retrieve the number of packages in each package status within your date range. Also, for each sender usage report, the first name and last name is outputted to the console.

// Get the list of sender usage reports
List<SenderUsageReport> senderReports = report.getSenderUsageReports();

for (SenderUsageReport senderReport : senderReports) {
    // Print the sender's name
    System.out.println("\nSender \"" + senderReport.getSender().getFirstName() + " " + senderReport.getSender().getLastName() + "\" has: \n");

    // Get the usage report categories and their counts
    EnumMap<UsageReportCategory, Integer> usageReportCategory = senderReport.getCountByUsageReportCategory();
    Iterator<UsageReportCategory> enumKeySet = usageReportCategory.keySet().iterator();

    // Iterate through the usage report categories and print the counts
    while (enumKeySet.hasNext()) {
        UsageReportCategory currentUsageReportCategory = enumKeySet.next();
        System.out.println(usageReportCategory.get(currentUsageReportCategory) + " packages in " + currentUsageReportCategory + " status");
    }
}

You can also download this report in CSV format, by using the following code:

// Download the usage report as a CSV for the specified date range
String reportCSV = client.getReportService().downloadUsageReportAsCSV(from, to);

Results

Here is an example of what you can expect to see once you have run your code.

.NET SDK

To download the full code sample see our Code Share site.

The Usage Report displays, for each sender, the number of packages that are in each possible state (for example, DRAFT, SENT, COMPLETED).

Retrieving a Usage Report

You can retrieve the Usage Report by using the OneSpan Sign ReportService. You will need the date range you want to retrieve.

 UsageReport report = client.ReportService.DownloadUsageReport(from, to); 

Sender Usage Reports are returned to you as a list. You will need to loop through each individual sender Usage Report. To do so, an iterator is used to retrieve the number of packages in each package status within your date range. Also, for each sender usage report, the first name and last name is outputted to the console.

// Get the list of sender usage reports
IList<SenderUsageReport> senderReports = report.SenderUsageReports;

foreach (SenderUsageReport senderReport in senderReports)
{
    // Print the sender's name
    Debug.WriteLine("\nSender \"" + senderReport.Sender.FirstName + " " + senderReport.Sender.LastName + "\" has: \n");

    // Get the usage report categories and their counts
    IDictionary<UsageReportCategory, int> usageReportCategory = senderReport.CountByUsageReportCategory;
    IEnumerator<KeyValuePair<UsageReportCategory, int>> enumKeySet = usageReportCategory.GetEnumerator();

    // Iterate through the usage report categories and print the counts
    while (enumKeySet.MoveNext())
    {
        Debug.WriteLine(enumKeySet.Current.Value + " packages in " + enumKeySet.Current.Key + " status");
    }
}

You can also download this report in CSV format, by using the following code:

// Download the usage report as a CSV for the specified date range
string reportCSV = client.ReportService.DownloadUsageReportAsCSV(from, to);

Results

Here is an example of what you can expect to see once you have run your code.

REST API

To download the full code sample see our Code Share site.

The Usage Report displays, for each sender, the number of packages that are in each possible state (for example, DRAFT, SENT, COMPLETED).

Retrieving a Usage Report

Retrieving a usage report is done by making the following request:

HTTP Request

GET /api/reports/usage?from={date}&to={date}

HTTP Headers

Accept: application/json   
Content-Type: application/json   
Authorization: Basic api_key 

You will need to pass as parameters the date range you want to retrieve. Then, you will need to loop through each individual sender usage report in the JSON response in order to retrieve the number of packages in each package status. In the sample code below, an iterator is used to loop through the JSON response.

Response Payload

{
  "from": "2017-11-17T00:00:00Z",
  "senders": [
    {
      "sender": {
        "status": "ACTIVE",
        "language": "en",
        "signature": {
          "handdrawn": "AQAAADJI+a4cnf0t3Dlf0GqWJceCA+4AAwADAN8BAAADAAAAggPuAOgAAAACfyxAUkAlQCdAOUA6QDtAHEAtQBtACkAJQBVAFBIyfkA0QBVABkAYQCpAHEAtQC9ALkAtQDxAO0A6QEhAN0AlQCQyTjZAgEBwQIBAoFDSUOFQ8lDiUNJQ0lCiQHBAUCIXGVBSUCVQN1BJUDpQXVA9UE5QLlAuUDpQOVAkm1BhQLZAd0B7QFpAXUBPQTBAHkAdQAtAB2AmYBRgQmCAcJVwmHC5Mh42QFBAkECAQKBAsEDAQNBQ8VDyUPJQ81DTULRQg1ByUEGeIgQ6QDhAJ0AmQCZAFItwbHBtMhdBUCafUGJQcVCSUJFQoUDAQKBAsECBQHNAdEBEQDRABkAFYCdgR2BXYHhgd2CIYIVgdmBDYEJAUUBwQIFAkECwQLBA0EDAQLBAoEBwQGASG0xAc0BnQEhASkArQBxADEAKQAlABkAFMkVKUENQUVBBUGFQYVCRUKJQsVDCUNJQsUDQQKBAkEBwQFJAREAlIllVUHFQUVByUKFQslDSUNJQ9VDlUPZQ1lDWUKVQZVBEUCQyCxivr2BjYGRgdGB1YHZgZmBWYEdgRkAFQClAREBjQJNAk0CzQKNAs0CjQJNAQo9gRWBjYJNgs2DCYNRg1GCkYKRgY2Bkrg==",
          "textual": null
        },
        "id": "ZQI8k6faVoM8",
        "data": {
          "serviceCredentials": "{}",
          "showIntro": false
        },
        "account": null,
        "title": null,
        "external": null,
        "updated": "2016-05-05T19:30:13Z",
        "memberships": [],
        "phone": "+1 201-555-5555",
        "professionalIdentityFields": [],
        "userCustomFields": [
          {
            "id": "policy_number_id",
            "data": null,
            "translations": [
              {
                "description": "Car Insurance Policy Number.",
                "language": "en",
                "id": "",
                "data": null,
                "name": "Policy Number"
              }
            ],
            "value": "",
            "name": ""
          }
        ],
        "locked": null,
        "activated": null,
        "company": "eSignLive",
        "email": "harishaidary@example.com",
        "firstName": "Haris",
        "lastName": "Haidary",
        "type": "MANAGER",
        "name": "",
        "address": null,
        "created": "2016-05-05T19:30:13Z",
        "specialTypes": [],
        "hasDelegates": false
      },
      "packages": {
        "draft": 1
      }
    },
    {
      "sender": {
        "status": "ACTIVE",
        "language": "en",
        "signature": {
          "handdrawn": "AQAAAMNxCV9Bvmy34F4trFmJ21OCA+4AAwADAFgBAAADAAAAggPuAKQAAAACdSdASkGLQB9BAEEYQAhgFWAUEhF8j0CNQZ9BMUJAQCxAJzJLK0B0QIFAwlQCVEJUVFgHUPNQgTIKNGCEYGdgfGCOYFthR2FEQUhAiUDnRCJUgVRHVZRRslFGUQZxonUAdFp0RGSRYOhgm2BeYD9APEDHQJFQcRJQPEBJQCtBIUElQnRBMkAsQCVQYVB2ULVQ1VD0UOZUpUDTQLFAUUA0MH5QC1AfUC5RI1FBUuZQSFSBQYBBZUFjQU1BAEAsQCdgJHDIcGQyUBxAgEDQUPFUQlRhVHNUElD2UHKbMgYtQGFA4FChVGJYhFSEVBFQcUAGYEpgrGCpYMdgtWD3YIRgZGBCYEMyMzSPQEJAaECoQIZAhUCFQMhAVo4iFA+vYDlgKUAXQHRAg1QGUEVQR3A2cIhw13DEcMFgYmBEYCpACEBFQIdAhECRUHFQQw==",
          "textual": null
        },
        "id": "E5b38STIWcMI",
        "data": {
          "serviceCredentials": "{}",
          "showIntro": false
        },
        "account": null,
        "title": null,
        "external": null,
        "updated": "2016-05-10T14:24:46Z",
        "memberships": [],
        "phone": "",
        "professionalIdentityFields": [],
        "userCustomFields": [],
        "locked": null,
        "activated": null,
        "company": "ESIGN",
        "email": "price9872@gmail.com",
        "firstName": "Johnny",
        "lastName": "Cash",
        "type": "REGULAR",
        "name": "",
        "address": null,
        "created": "2016-05-10T14:24:46Z",
        "specialTypes": [],
        "hasDelegates": false
      },
      "packages": {}
    },
    {
      "sender": {
        "status": "ACTIVE",
        "language": "en",
        "signature": {
          "handdrawn": "AQAAANJsTUwxfNU+Ldhp6TyKit+CA+4AAwADAPYCAAADAAAAggPuAH4BAAACeCZgFUAHQAhABUAGQAdAB2AZYChgGGAZQAlACkAIQAlAB2AVQAcSC4JANEAVQAVAFUAXQAZAJkAWQCdARkA0QESOQGNAYUBxQIBAgECAUIJQc1BkUFVQVlA4UClQGVAIUAdwFnAVu3AkvmBQYENgRWA3YCpgLGA+YC5gLWAdQAtACUAIQAZAJUA2j0BBn1AFUBZQBxIUOFAlUDSbUFaeUEJQYVBhQHBAkEC2QLdAyUC5QIhAd0BGQBVABUAFYDVgZmBkYIVghWB0YJVgY2B0YHJgUmBBYGFwgr9wRHBEcEVwNXA0cDVwF1AHUCSfUERQU1BSUEFQoUBgQHBAkUByQJNAg0CCQHJAUkBRQIBAcFBSUEJQRJtQBTIVOUAkQCZAN0BJQDhAW0BaQFpASUBZQEdAJkAkQCRQBnA1cDZwVnBncGdwZ3BWcDVwNnAmcBVQBlAFUCZQJJ9QRFBEUGNQUlBSUFFQUlBhAhAZQAhACEAJQCdANkA0QFRAgUBgQGBAYFBzUGRQdlBHUDpQKFAZUAlQB1AGcCVwNGBRQApACUAaQExAG0BNQE1ATUBrQHpAiEB0QHRAU45gkGBwYIFgwGDQYOBkAGQCYOJg4mChYJJgYGBwcEK/cCSbUGJQQVBBErB7QAhAFkAYQCpAGEAaQClAGkAZQBdAJ0AFQBQSAnaeQIBAskCCQINAs0CkQKNAtUCkQKVAlECVQHVAdkBUQEZAJEAGQAVAB2A2YFZgdmCVYKVgtGC1YMNgw2CyYMFgoWCgYJBgcGBwYGBgUHBxcEESsjRgcGBRYFSvYDRgJWAnYBZAB0AGQBhANI9AREBSQGFAYEBgQFBQUlBTn1BEUBRQBVAGcBVwNnA1cDRwNHBFcES/cEK+cFFwQWBQrwJBF1Bz

You can also download the usage report in CSV format by setting the Accept header to text/csv.


Was this article helpful?

Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.
ESC

Ozzy, our interactive help assistant