wxc_sdk.reports package

Reports API

class wxc_sdk.reports.ValidationRules(*, field: Optional[str] = None, required: Optional[str] = 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: Optional[str]

Field on which validation rule is applied

required: Optional[str]

Whether the above field is required

class wxc_sdk.reports.ReportTemplate(*, Id: Optional[int] = None, title: Optional[str] = None, service: Optional[str] = None, maxDays: Optional[int] = None, startDate: Optional[date] = None, endDate: Optional[date] = None, identifier: Optional[str] = None, validations: Optional[list[wxc_sdk.reports.ValidationRules]] = 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: Optional[int]

Unique identifier representing a report.

title: Optional[str]

Name of the template.

service: Optional[str]

The service to which the report belongs.

max_days: Optional[int]

Maximum date range for reports belonging to this template.

start_date: Optional[date]
end_date: Optional[date]
identifier: Optional[str]

Generated reports belong to which field.

validations: Optional[list[wxc_sdk.reports.ValidationRules]]

an array of validation rules

class wxc_sdk.reports.Report(*, Id: Optional[str] = None, title: Optional[str] = None, service: Optional[str] = None, startDate: Optional[date] = None, endDate: Optional[date] = None, siteList: Optional[str] = None, created: Optional[datetime] = None, createdBy: Optional[str] = None, scheduleFrom: Optional[str] = None, status: Optional[str] = None, downloadDomain: Optional[str] = None, downloadURL: Optional[str] = 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: Optional[str]

Unique identifier for the report.

title: Optional[str]

Name of the template to which this report belongs.

service: Optional[str]

The service to which the report belongs.

start_date: Optional[date]

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

end_date: Optional[date]

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

site_list: Optional[str]

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

created: Optional[datetime]

Time of creation for this report.

created_by: Optional[str]

The person who created the report.

schedule_from: Optional[str]

Whether this report was scheduled from API or Control Hub.

status: Optional[str]

Completion status of this report.

download_domain: Optional[str]
download_url: Optional[str]

The link from which the report can be downloaded.

class wxc_sdk.reports.ReportsApi(*, session: RestSession, base: Optional[str] = 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: Optional[str] = None, service: Optional[str] = None, template_id: Optional[str] = None, from_date: Optional[date] = None, to_date: Optional[date] = 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: Optional[date] = None, end_date: Optional[date] = None, site_list: Optional[str] = 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: Optional[datetime] = None, answer_time: Optional[datetime] = None, Duration: Optional[int] = None, calling_number: Optional[str] = None, called_number: Optional[str] = None, User: Optional[str] = None, calling_line_id: Optional[str] = None, called_line_id: Optional[str] = None, correlation_id: Optional[str] = None, Location: Optional[str] = None, inbound_trunk: Optional[str] = None, outbound_trunk: Optional[str] = None, route_group: Optional[str] = None, Direction: Optional[str] = None, call_type: Optional[str] = None, client_type: Optional[str] = None, client_version: Optional[str] = None, sub_client_type: Optional[str] = None, os_type: Optional[str] = None, device_mac: Optional[str] = None, Answered: Optional[bool] = None, international_country: Optional[str] = None, original_reason: Optional[str] = None, related_reason: Optional[str] = None, redirect_reason: Optional[str] = None, site_main_number: Optional[str] = None, site_timezone: Optional[int] = None, user_type: Optional[str] = None, call_id: Optional[str] = None, user_uuid: Optional[str] = None, org_uuid: Optional[str] = None, report_id: Optional[str] = None, department_id: Optional[str] = None, site_uuid: Optional[str] = None, releasing_party: Optional[str] = None, redirecting_number: Optional[str] = None, transfer_related_call_ID: Optional[str] = None, dialed_digits: Optional[str] = None, authorization_code: Optional[str] = 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: Optional[datetime]
answer_time: Optional[datetime]
duration: Optional[int]
calling_number: Optional[str]
called_number: Optional[str]
user: Optional[str]
calling_line_id: Optional[str]
called_line_id: Optional[str]
correlation_id: Optional[str]
location: Optional[str]
inbound_trunk: Optional[str]
outbound_trunk: Optional[str]
route_group: Optional[str]
direction: Optional[str]
call_type: Optional[str]
client_type: Optional[str]
client_version: Optional[str]
sub_client_type: Optional[str]
os_type: Optional[str]
device_mac: Optional[str]
answered: Optional[bool]
international_country: Optional[str]
original_reason: Optional[str]
related_reason: Optional[str]
redirect_reason: Optional[str]
site_main_number: Optional[str]
site_timezone: Optional[int]
user_type: Optional[str]
call_id: Optional[str]
user_uuid: Optional[str]
org_uuid: Optional[str]
report_id: Optional[str]
department_id: Optional[str]
site_uuid: Optional[str]
releasing_party: Optional[str]
redirecting_number: Optional[str]
dialed_digits: Optional[str]
authorization_code: Optional[str]
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)))