Per REST API v1

Reporting

To request a report of activity from Per, use the Reporting API.

Authentication

The Reporting API requires an Authorization token with a scope that includes “reporting”. See the general Authentication documentation regarding authenticating with the Per API.

Get a report of activity (reports.get)

Request a report of user activity between optional start and end dates. The response includes data for all billing IDs recorded by your application during the time range requested.

GET /reports.get [ ?start=START] [ &end=END]

(Try the API)

Input

NameTypeDescription
startstringOptional, but required if end is given. Indicates the date/time for the start of the report. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ If not specified, defaults to the beginning of the prior month. (For example, if called on Febrary 14, the start date will be January 1.)
endstringOptional. Indicates the date/time for the end of the report. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ If not specified, and if start is also not specified, defaults to the end of the prior month. (For example, if called on Febrary 14, the end date will be January 31.) If a start value is given, end is left unbounded.

Response

Status: 200 OK

{
  "ok": true,
  "result": {
    "start": "2018-12-01T00:00:00.000Z",
    "end": "2018-12-31T23:59:59.999Z",
    "activityTypes": {
      "ACTIVITY_TYPE_ID": {
        "billingIds": {
          "GROUP_A": {
            "unique": 59
          },
          "GROUP_B": {
            "unique": 538
          },
          "GROUP_C": {
            "unique": 2
          },
        }
      }
    }
  }
}

In this above hypothetical example showing a report for December 2018, there is one activity type. Within this activity type, there are three customers who need to be billed. The customer GROUP_A should be billed for 59 unique users. The customer GROUP_B had 538 unique users during the month, and the customer GROUP_C had only 2 unique users.