wxc_sdk.reports package

Reports API

class wxc_sdk.reports.ValidationRules(*, field: str | None = None, required: str | None = None)[source]

Bases: ApiModel

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

field: str | None

Field on which validation rule is applied

required: str | None

Whether the above field is required

class wxc_sdk.reports.ReportTemplate(*, Id: int | None = None, title: str | None = None, service: str | None = None, maxDays: int | None = None, startDate: date | None = None, endDate: date | None = None, identifier: str | None = None, validations: list[wxc_sdk.reports.ValidationRules] | None = None)[source]

Bases: ApiModel

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

id: int | None

Unique identifier representing a report.

title: str | None

Name of the template.

service: str | None

The service to which the report belongs.

max_days: int | None

Maximum date range for reports belonging to this template.

start_date: date | None
end_date: date | None
identifier: str | None

Generated reports belong to which field.

validations: list[wxc_sdk.reports.ValidationRules] | None

an array of validation rules

class wxc_sdk.reports.Report(*, Id: str | None = None, title: str | None = None, service: str | None = None, startDate: date | None = None, endDate: date | None = None, siteList: str | None = None, created: datetime | None = None, createdBy: str | None = None, scheduleFrom: str | None = None, status: str | None = None, downloadDomain: str | None = None, downloadURL: str | None = None)[source]

Bases: ApiModel

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

id: str | None

Unique identifier for the report.

title: str | None

Name of the template to which this report belongs.

service: str | None

The service to which the report belongs.

start_date: date | None

The data in this report belongs to dates greater than or equal to this.

end_date: date | None

The data in this report belongs to dates smaller than or equal to this.

site_list: str | None

The site to which this report belongs to. This only exists if the report belongs to service Webex.

created: datetime | None

Time of creation for this report.

created_by: str | None

The person who created the report.

schedule_from: str | None

Whether this report was scheduled from API or Control Hub.

status: str | None

Completion status of this report.

download_domain: str | None
download_url: str | None

The link from which the report can be downloaded.

class wxc_sdk.reports.ReportsApi(*, session: RestSession, base: str | None = None)[source]

Bases: ApiChild

Report templates are available for use with the Reports API.

To access this endpoint, you must use an administrator token with the analytics:read_all scope. The authenticated user must be a read-only or full administrator of the organization to which the report belongs.

To use this endpoint the organization needs to be licensed for Pro Pack for Control Hub.

Reports available via Webex Control Hub may be generated and downloaded via the Reports API. To access this API, the authenticated user must be a read-only or full administrator of the organization to which the report belongs.

list_templates() list[wxc_sdk.reports.ReportTemplate][source]

List all the available report templates that can be generated.

CSV (comma separated value) reports for Webex services are only supported for organizations based in the North American region. Organizations based in other regions will return blank CSV files for any Webex reports.

Returns:

list of report templates

Return type:

list[ReportTemplate]

list(report_id: str | None = None, service: str | None = None, template_id: str | None = None, from_date: date | None = None, to_date: date | None = None) Generator[Report, None, None][source]

Lists all reports. Use query parameters to filter the response. The parameters are optional. However, from and to parameters should be provided together.

CSV reports for Teams services are only supported for organizations based in the North American region. Organizations based in a different region will return blank CSV files for any Teams reports.

Parameters:
  • report_id – List reports by ID.

  • service – List reports which use this service.

  • template_id – List reports with this report template ID.

  • from_date – List reports that were created on or after this date.

  • to_date – List reports that were created before this date.

Returns:

yields Report instances

create(template_id: int, start_date: date | None = None, end_date: date | None = None, site_list: str | None = None) str[source]

Create a new report. For each templateId, there are a set of validation rules that need to be followed. For example, for templates belonging to Webex, the user needs to provide siteUrl. These validation rules can be retrieved via the Report Templates API.

CSV reports for Teams services are only supported for organizations based in the North American region. Organizations based in a different region will return blank CSV files for any Teams reports.

Parameters:
  • template_id (int) – Unique ID representing valid report templates.

  • start_date (date) – Data in the report will be from this date onwards.

  • end_date (date) – Data in the report will be until this date.

  • site_list (str) – Sites belonging to user’s organization. This attribute is needed for site-based templates.

Returns:

The unique identifier for the report.

Return type:

str

details(report_id: str) Report[source]

Shows details for a report, by report ID.

Specify the report ID in the reportId parameter in the URI.

CSV reports for Teams services are only supported for organizations based in the North American region. Organizations based in a different region will return blank CSV files for any Teams reports.

Parameters:

report_id (str) – The unique identifier for the report.

Returns:

report details

Return type:

Report

delete(report_id: str)[source]

Remove a report from the system.

Specify the report ID in the reportId parameter in the URI

CSV reports for Teams services are only supported for organizations based in the North American region. Organizations based in a different region will return blank CSV files for any Teams reports.

Parameters:

report_id (str) – The unique identifier for the report.

download(url: str) Generator[dict, None, None][source]

Download a report from the given URL and yield the rows as dicts

Parameters:

url (str) – download URL

Returns:

yields dicts

base = 'devices'
session: RestSession

REST session

class wxc_sdk.reports.CallingCDR(*, start_time: datetime | None = None, answer_time: datetime | None = None, Duration: int | None = None, calling_number: str | None = None, called_number: str | None = None, User: str | None = None, calling_line_id: str | None = None, called_line_id: str | None = None, correlation_id: str | None = None, Location: str | None = None, inbound_trunk: str | None = None, outbound_trunk: str | None = None, route_group: str | None = None, Direction: str | None = None, call_type: str | None = None, client_type: str | None = None, client_version: str | None = None, sub_client_type: str | None = None, os_type: str | None = None, device_mac: str | None = None, Answered: bool | None = None, international_country: str | None = None, original_reason: str | None = None, related_reason: str | None = None, redirect_reason: str | None = None, site_main_number: str | None = None, site_timezone: int | None = None, user_type: str | None = None, call_id: str | None = None, user_uuid: str | None = None, org_uuid: str | None = None, report_id: str | None = None, department_id: str | None = None, site_uuid: str | None = None, releasing_party: str | None = None, redirecting_number: str | None = None, transfer_related_call_ID: str | None = None, dialed_digits: str | None = None, authorization_code: str | None = None)[source]

Bases: ApiModel

Records in a Calling Detailed Call History report

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

start_time: datetime | None
answer_time: datetime | None
duration: int | None
calling_number: str | None
called_number: str | None
user: str | None
calling_line_id: str | None
called_line_id: str | None
correlation_id: str | None
location: str | None
inbound_trunk: str | None
outbound_trunk: str | None
route_group: str | None
direction: str | None
call_type: str | None
client_type: str | None
client_version: str | None
sub_client_type: str | None
os_type: str | None
device_mac: str | None
answered: bool | None
international_country: str | None
original_reason: str | None
related_reason: str | None
redirect_reason: str | None
site_main_number: str | None
site_timezone: int | None
user_type: str | None
call_id: str | None
user_uuid: str | None
org_uuid: str | None
report_id: str | None
department_id: str | None
site_uuid: str | None
releasing_party: str | None
redirecting_number: str | None
dialed_digits: str | None
authorization_code: str | None
classmethod from_dicts(dicts: Iterable[dict]) Generator[CallingCDR, None, None][source]

Yield CallingCDR instances from dicts

Parameters:

dicts – iterable with the dicts to yield CDRs from

Returns:

yields CallingCDR instances

Example

# download call history report from Webex
cdrs = list(CallingCDR.from_dicts(api.reports.download(url=url)))