Expand option in Schedules API

Team,
I am trying to extract Schedule Ids along with associated agent ids, I tried using expand option available for this API. But it is not fetching any results.

I am using expand options as -- expand = 'managementUnits.agents'

Can you please assist?

API - /api/v2/workforcemanagement/businessunits/{businessUnitId}/weeks/{weekid}/schedules

Using Python SDK

-- create an instance of the API class

api_instance = PureCloudPlatformClientV2.WorkforceManagementApi();

-- Get Schedule Ids for Bu

business_unit_id = ['xyz123-234i23'] # example BU id
week_id = '2023-07-23'
expand = 'managementUnits.agents'

try:
api_response = api_instance.get_workforcemanagement_businessunit_week_schedules(business_unit_id, week_id, expand=expand)
except:

You're conflating two separate APIs. You have to call

GET /api/v2/workforcemanagement/businessunits/{businessUnitId}/weeks/{weekId}/schedules

first, to get the metadata (no expands there), THEN loop through the results calling the very similarly named

GET /api/v2/workforcemanagement/businessunits/{businessUnitId}/weeks/{weekId}/schedules/{scheduleId}

with that expands using the schedule ids from the 1st result as the last parameter in the 2nd version.

1 Like

Thanks a lot, this one works.

Regards,
Sathish

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.