Team, error while fetching data for
/api/v2/workforcemanagement/managementunits/{managementUnitId}/timeofflimits/values/query
Error Message: AttributeError: 'QueryTimeOffLimitValuesRequest' object has no attribute 'dateRanges'. Did you mean: 'date_ranges'?
Query :
body = PureCloudPlatformClientV2.QueryTimeOffLimitValuesRequest()
body.activityCodeId = '8160cba2-7884-4d1e-b57d-c0facfcecb47'
body.dateRanges.startDate = '2023-06-10'
body.dateRanges.endDate = '2023-06-30'
res = api_instance.post_workforcemanagement_managementunit_timeofflimits_values_query(management_unit_id, body=body)
print(res.to_json())
What should be the correct method to call dateRanges, please assist?
Hi,
The date_ranges
property is an array of LocalDateRange
objects so you will need to create that and add it to the body. Python also uses snake case for variable so when setting variables on objects you will need to use snake_case
. Your code should look something like this
body = PureCloudPlatformClientV2.QueryTimeOffLimitValuesRequest()
body.activity_code_id = '8160cba2-7884-4d1e-b57d-c0facfcecb47'
body.date_ranges = [PureCloudPlatformClientV2.LocalDateRange()]
body.date_ranges[0].start_date = '2023-06-10'
body.date_ranges[0].end_date = '2023-06-30'
Regards,
Declan
1 Like
It worked. Thanks a lot Declan.
Regards,
Sathish
system
Closed
August 26, 2023, 10:21am
4
This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.