Usage Report

The following guide shows you how to retrieve the usage report.

The usage report contains information for each sender the number of packages in each package status (e.g. DRAFT, SENT, COMPLETED, etc.).

The Code

You can download the complete example code from the Developer Community Code Share, here.

Retrieving the usage report is done with the OneSpan Sign ReportService. You will need to pass as parameters the date range you want to retrieve.

UsageReport report = client.getReportService().downloadUsageReport(from, to);

Sender usage reports are returned to you as a list from OneSpan Sign. You will need to loop through each individual sender usage report. To do so, an iterator is used to retrieve the 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.

List<SenderUsageReport> senderReports = report.getSenderUsageReports();
		
for(SenderUsageReport senderReport : senderReports) {
			
       System.out.println("\nSender \"" + senderReport.getSender().getFirstName() + " " + senderReport.getSender().getLastName() + "\" has: \n");
			
       EnumMap<UsageReportCategory, Integer> usageReportCategory = senderReport.getCountByUsageReportCategory();
			
       Iterator<UsageReportCategory> enumKeySet = usageReportCategory.keySet().iterator();
			
       while(enumKeySet.hasNext()){
	            UsageReportCategory currentUsageReportCategory = enumKeySet.next();
	            System.out.println(usageReportCategory.get(currentUsageReportCategory) + " packages in " + currentUsageReportCategory + " status");
       }

}

You can also download the usage report as CSV format:

String reportCSV = client.getReportService().downloadUsageReportAsCSV(from, to);

Running Your Code

Below is a screenshot of the console output you can expect once you’ve run your code.

Capture

Get the Code

The usage report contains information for each sender the number of packages in each package status (e.g. DRAFT, SENT, COMPLETED, etc.).

The Code

You can download the complete example code from the Developer Community Code Share, here.

Retrieving the usage report is done with the OneSpan Sign ReportService. You will need to pass as parameters the date range you want to retrieve.

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

Sender usage reports are returned to you as a list from OneSpan Sign. You will need to loop through each individual sender usage report. To do so, an iterator is used to retrieve the 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.

IList<SenderUsageReport> senderReports = report.SenderUsageReports;

foreach (SenderUsageReport senderReport in senderReports)
{

       Debug.WriteLine("\nSender \"" + senderReport.Sender.FirstName + " " + senderReport.Sender.LastName + "\" has: \n");
       IDictionary<UsageReportCategory, int> usageReportCategory = senderReport.CountByUsageReportCategory;
       IEnumerator<KeyValuePair<UsageReportCategory, int>> enumKeySet = usageReportCategory.GetEnumerator();

       while (enumKeySet.MoveNext())
       {
              Debug.WriteLine(enumKeySet.Current.Value + " packages in " + enumKeySet.Current.Key + " status");
       }
}

You can also download the usage report as CSV format:

string reportCSV = client.ReportService.DownloadUsageReportAsCSV(from, to);

Running Your Code

Below is a screenshot of the console output you can expect once you’ve run your code.

Capture

Get the Code

The usage report contains information for each sender the number of packages in each package status (e.g. DRAFT, SENT, COMPLETED, etc.).

The Code

You can download the complete example code from the Developer Community Code Share, here.

Retrieving the 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 resposne 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@mailinator.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+cFFwQWBQrwJBF1BzUENQQlBDn1BDn5tQJHAkcHFgYGBgYGBgUGBQYEKvr2AmQAdABkAmj0BEQFJAYkBxQHJAgUCBQHBAcEBwQGBAUEBQQIBAcA==",
          "textual": null
        },
        "id": "rNs5hVUQ0mQY",
        "data": {
          "serviceCredentials": "{}",
          "showIntro": true
        },
        "account": null,
        "title": null,
        "external": null,
        "updated": "2016-05-10T14:24:55Z",
        "memberships": [],
        "phone": "",
        "professionalIdentityFields": [],
        "userCustomFields": [],
        "locked": null,
        "activated": null,
        "company": "eSignLive",
        "email": "sstamkos4@gmail.com",
        "firstName": "Mary",
        "lastName": "Doe",
        "type": "MANAGER",
        "name": "",
        "address": null,
        "created": "2016-05-10T14:24:56Z",
        "specialTypes": [],
        "hasDelegates": false
      },
      "packages": {}
    },
    {
      "sender": {
        "status": "ACTIVE",
        "language": "en",
        "signature": null,
        "id": "FxktNzFzmkIY",
        "data": {
          "hasNotCreatedATransaction": true,
          "showIntro": true
        },
        "account": null,
        "title": null,
        "external": null,
        "updated": "2017-10-23T21:26:54Z",
        "memberships": [],
        "phone": "",
        "professionalIdentityFields": [],
        "userCustomFields": [],
        "locked": null,
        "activated": null,
        "company": "esl",
        "email": "mail55@mailinator.com",
        "firstName": "Max",
        "lastName": "Domi",
        "type": "REGULAR",
        "name": "",
        "address": null,
        "created": "2017-10-23T21:26:55Z",
        "specialTypes": [],
        "hasDelegates": false
      },
      "packages": {}
    },
    {
      "sender": {
        "status": "ACTIVE",
        "language": "en",
        "signature": null,
        "id": "IBCyHvarzWsX",
        "data": {
          "hasNotCreatedATransaction": true,
          "showIntro": true
        },
        "account": null,
        "title": null,
        "external": null,
        "updated": "2017-11-13T15:07:49Z",
        "memberships": [],
        "phone": "",
        "professionalIdentityFields": [],
        "userCustomFields": [],
        "locked": null,
        "activated": null,
        "company": "",
        "email": "mail73@mailinator.com",
        "firstName": "Peter",
        "lastName": "Pan",
        "type": "REGULAR",
        "name": "",
        "address": null,
        "created": "2017-11-13T15:07:49Z",
        "specialTypes": [],
        "hasDelegates": false
      },
      "packages": {}
    },
    {
      "sender": {
        "status": "ACTIVE",
        "language": "en",
        "signature": null,
        "id": "2q37oSloj5AD",
        "data": {
          "hasNotCreatedATransaction": true,
          "showIntro": true
        },
        "account": null,
        "title": null,
        "external": null,
        "updated": "2017-11-13T15:07:49Z",
        "memberships": [],
        "phone": "",
        "professionalIdentityFields": [],
        "userCustomFields": [],
        "locked": null,
        "activated": null,
        "company": "",
        "email": "mail72@mailinator.com",
        "firstName": "Mike",
        "lastName": "Tango",
        "type": "REGULAR",
        "name": "",
        "address": null,
        "created": "2017-11-13T15:07:50Z",
        "specialTypes": [],
        "hasDelegates": false
      },
      "packages": {}
    },
    {
      "sender": {
        "status": "ACTIVE",
        "language": "en",
        "signature": null,
        "id": "bg65Jj1lR0Y5",
        "data": {
          "hasNotCreatedATransaction": true,
          "showIntro": true
        },
        "account": null,
        "title": null,
        "external": null,
        "updated": "2017-11-13T15:07:50Z",
        "memberships": [],
        "phone": "",
        "professionalIdentityFields": [],
        "userCustomFields": [],
        "locked": null,
        "activated": null,
        "company": "",
        "email": "mail71@mailinator.com",
        "firstName": "John",
        "lastName": "Smith",
        "type": "REGULAR",
        "name": "",
        "address": null,
        "created": "2017-11-13T15:07:50Z",
        "specialTypes": [],
        "hasDelegates": false
      },
      "packages": {}
    }
  ],
  "to": "2017-11-17T20:12:40Z"
}

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

Get the Code