Reports


API for browsing, adding, editing and deleting Reports.

Objects

ReportParameters

{
  "ReportId": 0,
  "Name": "",
  "Description": "",
  "Parameters": [],
}
Field Description
ReportId The unique id that identifies the report.
Name The name of the report.
Description The description of the report.
Parameters Parameters used to specify the reporting criteria (Start Date, End Date, etc.).

ReportParameter

{
  "LabelText": "",
  "VarName": "",
  "Range": "",
  "RangeType": "",
  "SelectionListUrl": "",
  "Value": ""
}
Field Description
LabelText The label that should be displayed next to the input control when prompting the user for this parameter.
VarName The variable name used by the report internally.
DefaultValue The default value of this setting.
Range The range of acceptable values for this setting based on the RangeType.
RangeType Specifies the type of range for value selection and validation.
SelectionListUrl If present, this URL will be used to get a list of values to select (See http://wsapidocs.ivr.com/resource-lookup-get.html#returning-a-list-of-resource-names).
Value The value of the parameter. When retrieving parameters via ivrapi/Reports/{ReportId}/Parameters, this will be the default value that should be used to initialize the input control (e.g., the date that should be displayed for a RangeType of dtDate). NOTE: Date values must be in LOCAL time. The API will perform conversions to UTC as necessary.

Notes

Range Types and Validation
For consistency, the range types are the same as those used by System & Module Settings.

IMPORTANT
(1) When generating a report via PUT ivrapi/reports, only the Value field in each report parameter should be modified. All of the other fields should remain unchanged.

(2) As noted in the Value column below, unlike System & Module Settings, in cases where an item is selected from a list via SelectionListUrl, the Value should be set to the Name field instead of the Id field returned by the list of resources (See http://wsapidocs.ivr.com/resource-lookup-get.html#returning-a-list-of-resource-names).

Range Type Control Value Notes
rtAccountGroup List Name Use SelectionListUrl to get a list of values.
rtBatch List Name Use SelectionListUrl to get a list of values.
rtClassOfService List Name Use SelectionListUrl to get a list of values.
rtCodec List Name Use SelectionListUrl to get a list of values.
rtCostSchedule List Name Use SelectionListUrl to get a list of values.
rtModule List Name Use SelectionListUrl to get a list of values.
rtModulesAll List Name Use SelectionListUrl to get a list of values.
rtNode List Text Use SelectionListUrl to get a list of values.
rtOrigin List Text Use SelectionListUrl to get a list of values.
rtPath Text Text Validation will be handled by the API.
rtRatePlan List Name Use SelectionListUrl to get a list of values.
rtRateSchedule List Name Use SelectionListUrl to get a list of values.
rtReadOnly Text N/A Read-only values cannot be modified.
rtRouteGroup List Name Use SelectionListUrl to get a list of values.
rtDate Date Text Date ISO8601 format.
rtTime 12 hour Time (am/pm) Text Value needs to be saved in in 00:00:00 format.
rtUTCOffset List Integer Display a list of valid UTC offsets.
rtSQL Text Text Not Implemented.
rtSQLId Text Text Not Implemented.
rtPaymentGateway List Name Use SelectionListUrl to get a list of values.
rtNumericRange Text Integer Range will be specified as 'Min-Max' (e.g., 10-60), so the value must be within this range to be valid.
rtNumericList List of numbers Integer Range will be specified as 'Min..Max' (e.g., 1..5). For this example, you would display a drop down list of integers from 1 to 5.
rtEnumeratedList Text Text Range will contain a list of acceptable values separated by commas (e.g., Yes,No).
rtText Text Text Any value.

Examples

Retrieve the parameters for a Billing Report' for a single account:

GET ivrapi/Reports/19/Parameters

{
  "status": "success",
  "message": "",
  "data": {
    "ReportId": 19,
    "Name": "Billing Report (Account)",
    "Description": "Billing Report (Account)",
    "Parameters": 
    [
      {
        "LabelText": "Start Date",
        "VarName": "StartDate",
        "Range": "",
        "RangeType": "rtDate",
        "SelectionListUrl": "",
        "Value": "2017-11-01"
      },
      {
        "LabelText": "End Date",
        "VarName": "EndDate",
        "Range": "",
        "RangeType": "rtDate",
        "SelectionListUrl": "",
        "Value": "2017-11-30"
      },
      {
        "LabelText": "Account",
        "VarName": "Acct",
        "Range": "",
        "RangeType": "rtText",
        "SelectionListUrl": "",
        "Value": ""
      }
    ]
  }
}

Get a list of reporting categories:

GET ivrapi/Reports/Categories

{
  "status": "success",
  "message": "",
  "data": 
  [
    {
      "Id": 0,
      "Name": "Accounts"
    },
    {
      "Id": 0,
      "Name": "Billing"
    },
    {
      "Id": 0,
      "Name": "Fraud"
    },
    {
      "Id": 0,
      "Name": "System"
    },
    {
      "Id": 0,
      "Name": "Traffic"
    }
  ]
}

Run a Billing Report for account 100 for the month of October 2017:

POST ivrapi/Reports

{
  "ReportId": 19,
  "Name": "Billing Report (Account)",
  "Description": "Billing Report (Account)",
  "Parameters": 
  [
    {
      "LabelText": "Start Date",
      "VarName": "StartDate",
      "Range": "",
      "RangeType": "rtDate",
      "SelectionListUrl": "",
      "Value": "2017-10-01" <-- 
    },
    {
      "LabelText": "End Date",
      "VarName": "EndDate",
      "Range": "",
      "RangeType": "rtDate",
      "SelectionListUrl": "",
      "Value": "2017-10-31" <--
    },
    {
      "LabelText": "Account",
      "VarName": "Acct",
      "Range": "",
      "RangeType": "rtText",
      "SelectionListUrl": "",
      "Value": "100" <--
    }
  ]
}