wxc_sdk
A simple SDK to work with Webex APIs, special focus on Webex Calling specific API endpoints.
This is how easy it is to use the SDK. The example code list all calling enabled users within the org.
1#!/usr/bin/env python
2"""
3Example script
4Get all calling users within the org
5"""
6
7from dotenv import load_dotenv
8
9from wxc_sdk import WebexSimpleApi
10
11load_dotenv()
12
13api = WebexSimpleApi()
14
15# using wxc_sdk.people.PeopleApi.list to iterate over persons
16# Parameter calling_data needs to be set to true to gat calling specific information
17# calling users have the attribute location_id set
18calling_users = [user for user in api.people.list(calling_data=True)
19 if user.location_id]
20print(f'{len(calling_users)} users:')
21print('\n'.join(user.display_name for user in calling_users))
Installation
Installing and upgrading wxc_sdk is easy:
Install via PIP
$ pip install wxc-sdk
Upgrade to the latest version
$ pip install wxc-sdk --upgrade
Documentation
Documentation is available at: http://wxc_sdk.readthedocs.io
Examples
Sample scripts are available in the examples folder.
Also the test cases in the tests folder can serve as examples of how to use the SDK.
Datatypes
Datatypes are defined in the respective subpackages and submodules and have to be imported from there explicitly:
from wxc_sdk.people import Person
from wxc_sdk.person_settings.barge import BargeSettings
To allow to abstract from the subpackage and submodule structure any datatype can also be imported from
wxc_sdk.all_types
directly:
from wxc_sdk.all_types import Person, BargeSettings
All wxc_sdk
data types can also be imported at once:
from wxc_sdk.all_types import *
Async version of the SDK (experimental)
With wxc_sdk.as_api.AsWebexSimpleApi
the SDK offers an async variant based on asyncio/aiohttp. This variant is
automatically generated based off the source of the synchronous API and offers async variants of the endpoints using the
same datastructures as the synchronous API.
Here is an example of how to use the async SDK:
1#!/usr/bin/env python
2"""
3Example script
4Get all calling users within the org using the (experimental) async API
5"""
6import asyncio
7import time
8
9from dotenv import load_dotenv
10
11from wxc_sdk.as_api import AsWebexSimpleApi
12
13load_dotenv()
14
15
16async def get_calling_users():
17 """
18 Get details of all calling enabled users by:
19 1) getting all calling users
20 2) collecting all users that have a calling license
21 3) getting details for all users
22 """
23 async with AsWebexSimpleApi(concurrent_requests=40) as api:
24 print('Collecting calling licenses')
25 calling_license_ids = set(lic.license_id for lic in await api.licenses.list()
26 if lic.webex_calling)
27
28 # get users with a calling license
29 calling_users = [user async for user in api.people.list_gen()
30 if any(lic_id in calling_license_ids for lic_id in user.licenses)]
31 print(f'{len(calling_users)} users:')
32 print('\n'.join(user.display_name for user in calling_users))
33
34 # get details for all users
35 start = time.perf_counter()
36 details = await asyncio.gather(*[api.people.details(person_id=user.person_id, calling_data=True)
37 for user in calling_users])
38 expired = time.perf_counter() - start
39 print(f'Got details for {len(details)} users in {expired * 1000:.3f} ms')
40
41
42if __name__ == '__main__':
43 asyncio.run(get_calling_users())
Reference
- wxc_sdk package
WebexSimpleApi
WebexSimpleApi.admin_audit
WebexSimpleApi.attachment_actions
WebexSimpleApi.authorizations
WebexSimpleApi.cdr
WebexSimpleApi.device_configurations
WebexSimpleApi.devices
WebexSimpleApi.events
WebexSimpleApi.groups
WebexSimpleApi.guests
WebexSimpleApi.licenses
WebexSimpleApi.locations
WebexSimpleApi.meetings
WebexSimpleApi.membership
WebexSimpleApi.messages
WebexSimpleApi.organizations
WebexSimpleApi.person_settings
WebexSimpleApi.people
WebexSimpleApi.reports
WebexSimpleApi.rooms
WebexSimpleApi.room_tabs
WebexSimpleApi.scim
WebexSimpleApi.status
WebexSimpleApi.teams
WebexSimpleApi.team_memberships
WebexSimpleApi.telephony
WebexSimpleApi.webhook
WebexSimpleApi.workspaces
WebexSimpleApi.workspace_locations
WebexSimpleApi.workspace_settings
WebexSimpleApi.session
WebexSimpleApi.access_token
WebexSimpleApi.close()
- Subpackages
- wxc_sdk.admin_audit package
- wxc_sdk.attachment_actions package
- wxc_sdk.authorizations package
- wxc_sdk.cdr package
- wxc_sdk.common package
UserType
UserBase
RingPattern
AlternateNumber
Greeting
UserNumber
PersonPlaceAgent
MonitoredMember
CallParkExtension
AuthCodeLevel
AuthCode
RouteType
DialPatternValidate
DialPatternStatus
RouteIdentity
Customer
IdOnly
IdAndName
PatternAction
NumberState
ValidationStatus
ValidateExtensionStatusState
ValidateExtensionStatus
ValidateExtensionsResponse
ValidatePhoneNumberStatusState
ValidatePhoneNumberStatus
ValidatePhoneNumbersResponse
StorageType
VoicemailMessageStorage
VoicemailEnabled
VoicemailNotifications
VoicemailFax
VoicemailTransferToNumber
VoicemailCopyOfMessage
AudioCodecPriority
AtaDtmfMode
AtaDtmfMethod
VlanSetting
AtaCustomization
DeviceCustomizations
DeviceCustomization
CommonDeviceCustomization
BacklightTimer
Background
BackgroundSelection
DisplayNameSelection
LoggingLevel
DisplayCallqueueAgentSoftkey
AcdCustomization
LineKeyLabelSelection
LineKeyLedPattern
PhoneLanguage
EnabledAndValue
WifiNetwork
MppCustomization
PrimaryOrShared
MediaFileType
AnnAudioFile
WifiCustomization
RoomType
LinkRelation
AnnouncementLevel
UsbPortsObject
WifiAuthenticationMethod
DirectoryMethod
CallHistoryMethod
MppVlanDevice
VolumeSettings
CallForwardExpandedSoftKey
HttpProxy
HttpProxyMode
BluetoothMode
BluetoothSetting
NoiseCancellation
SoftKeyLayout
SoftKeyMenu
PskObject
BackgroundImageColor
BacklightTimer68XX78XX
DectCustomization
OwnerType
NumberOwner
ApplyLineKeyTemplateAction
AssignedDectNetwork
DevicePlatform
- Submodules
- wxc_sdk.device_configurations package
- wxc_sdk.devices package
- wxc_sdk.events package
- wxc_sdk.groups package
- wxc_sdk.guests package
- wxc_sdk.integration package
- wxc_sdk.licenses package
- wxc_sdk.locations package
- wxc_sdk.meetings package
AttendeePrivileges
AudioConnectionOptions
AudioConnectionType
BreakoutSession
CallInNumbers
AnswerCondition
CustomizedQuestionForCreateMeeting
EntryAndExitTone
GetMeetingSurveyResponse
InputMode
InterpreterForSimultaneousInterpretation
InviteeForCreateMeeting
JoinMeetingResponse
TrackingCode
MeetingOptions
Meeting
MeetingType
NoteType
QuestionOption
TrackingCodeOption
PatchMeetingBody
PatchMeetingResponse
ApprovalQuestion
QuestionAnswer
Question
QuestionWithAnswers
Registration
AutoRegistrationResult
ApprovalRule
ScheduledMeeting
ScheduledType
MeetingService
SimultaneousInterpretation
StandardRegistrationApproveRule
MeetingState
SurveyResult
MeetingTelephony
TrackingCodeItem
Type
QuestionType
TrackingCodeType
UnlockedMeetingJoinSecurity
MeetingsApi
CreateMeetingBody
JoinMeetingBody
- Subpackages
- wxc_sdk.memberships package
- wxc_sdk.messages package
- wxc_sdk.organizations package
- wxc_sdk.people package
- wxc_sdk.person_settings package
- wxc_sdk.reports package
- wxc_sdk.room_tabs package
- wxc_sdk.rooms package
- wxc_sdk.scim package
- wxc_sdk.status package
- wxc_sdk.team_memberships package
- wxc_sdk.teams package
- wxc_sdk.telephony package
NumberListPhoneNumberType
TelephonyType
NumberListPhoneNumber
NumberType
NumberDetails
UCMProfile
TestCallRoutingResult
OriginatorType
CallSourceType
CallSourceInfo
DestinationType
LocationAndNumbers
HostedUserDestination
ServiceType
HostedFeatureDestination
TrunkDestination
PbxUserDestination
PstnNumberDestination
VirtualExtensionDestination
RouteListDestination
FeatureAccessCodeDestination
EmergencyDestination
DeviceType
DeviceManufacturer
DeviceManagedBy
OnboardingMethod
SupportedDevice
AnnouncementLanguage
TelephonyApi
DeviceSettingsConfiguration
SupportedDevices
- Subpackages
- Submodules
- wxc_sdk.webhook package
- wxc_sdk.workspace_locations package
- wxc_sdk.workspace_settings package
- wxc_sdk.workspaces package
- Submodules
- wxc_sdk.api_child module
- wxc_sdk.as_api module
AsAccessCodesApi
AsAdminAuditEventsApi
AsAgentCallerIdApi
AsAnnouncementApi
AsAnnouncementsRepositoryApi
AsApiChild
AsAppServicesApi
AsApplyLineKeyTemplatesJobsApi
AsAttachmentActionsApi
AsAuthorizationsApi
AsAutoAttendantApi
AsBargeApi
AsCQPolicyApi
AsCallBridgeApi
AsCallInterceptApi
AsCallParkApi
AsCallPickupApi
AsCallQueueApi
AsCallRecordingApi
AsCallRecordingSettingsApi
AsCallWaitingApi
AsCallerIdApi
AsCallingBehaviorApi
AsCallparkExtensionApi
AsCallsApi
AsDECTDevicesApi
AsDetailedCDRApi
AsDeviceConfigurationsApi
AsDeviceSettingsJobsApi
AsDevicesApi
AsDialPlanApi
AsDigitPatternsApi
AsDndApi
AsEventsApi
AsExecAssistantApi
AsForwardingApi
AsGroupsApi
AsGuestManagementApi
AsHotelingApi
AsHuntGroupApi
AsIncomingPermissionsApi
AsInternalDialingApi
AsJobsApi
AsLicensesApi
AsLocationAccessCodesApi
AsLocationInterceptApi
AsLocationMoHApi
AsLocationNumbersApi
AsLocationVoicemailSettingsApi
AsLocationsApi
AsManageNumbersJobsApi
AsMeetingChatsApi
AsMeetingClosedCaptionsApi
AsMeetingInviteesApi
AsMeetingParticipantsApi
AsMeetingPreferencesApi
AsMeetingQandAApi
AsMeetingQualitiesApi
AsMeetingTranscriptsApi
AsMeetingsApi
AsMembershipApi
AsMessagesApi
AsMonitoringApi
AsNumbersApi
AsOrganisationVoicemailSettingsAPI
AsOrganizationApi
AsOutgoingPermissionsApi
AsPagingApi
AsPeopleApi
AsPersonForwardingApi
AsPersonSettingsApi
AsPersonSettingsApiChild
AsPreferredAnswerApi
AsPremisePstnApi
AsPrivacyApi
AsPrivateNetworkConnectApi
AsPushToTalkApi
AsRebuildPhonesJobsApi
AsReceptionistApi
AsReceptionistContactsDirectoryApi
AsRecordingsApi
AsReportsApi
AsRestSession
AsRoomTabsApi
AsRoomsApi
AsRouteGroupApi
AsRouteListApi
AsSCIM2BulkApi
AsSCIM2UsersApi
AsScheduleApi
AsScimApiChild
AsScimV2Api
AsStatusAPI
AsTeamMembershipsApi
AsTeamsApi
AsTelephonyApi
AsTelephonyDevicesApi
AsTelephonyLocationApi
AsTransferNumbersApi
AsTrunkApi
AsVirtualLinesApi
AsVoiceMessagingApi
AsVoicePortalApi
AsVoicemailApi
AsVoicemailGroupsApi
AsVoicemailRulesApi
AsWebexSimpleApi
AsWebhookApi
AsWorkspaceDevicesApi
AsWorkspaceLocationApi
AsWorkspaceLocationFloorApi
AsWorkspaceNumbersApi
AsWorkspaceSettingsApi
AsWorkspacesApi
- wxc_sdk.as_rest module
- wxc_sdk.base module
- wxc_sdk.rest module
- wxc_sdk.scopes module
- wxc_sdk.tokens module
- Release history
- Logging of REST requests
- Examples
- Get all calling users
- Get all calling users (async variant)
- Get all users without phones
- Default call forwarding settings for all users
- Modify number of rings configuration for users read from CSV
- Holiday schedule w/ US national holidays for all US locations
- Holiday schedule w/ US national holidays for all US locations (async variant)
- Persist tokens and obtain new tokens interactively
- Read/update call intercept settings of a user
- Read/update call queue agent join states
- Using service APP tokens to access a API endpoints
- Pool unassigned TNs on hunt groups to catch calls to unassigned TNs
- Downgrade room device workspaces from Webex Calling to free calling
- Logout users by selectively revoking authorizations
- Reference of all available methods