Unable to setup date range filters

Team,
Trying to extract data from timeoff requests API using Python SDK. Can you help in fixing the syntax for date range.

Parameters
body = PureCloudPlatformClientV2.TimeOffRequestQueryBody()
body.dateRange = PureCloudPlatformClientV2.LocalDateRange()
body.dateRange.startDate = '2023-08-21'
body.dateRange.endDate = '2023-08-30'

Response received : HTTP response body: {"message":"Either the date range must be set or the list of statuses must be equal to PENDING"

Hello,

See TimeOffRequestQueryBody for the correct parameter names.

body.date_range = PureCloudPlatformClientV2.LocalDateRange()
body.date_range.start_date = '2023-08-21'
body.date_range.end_date = '2023-08-30'

Regards,

1 Like

Thanks Jerome. It worked.

Note: In API explorer it is given as
"dateRange": {
"startDate": "2023-07-21",
"endDate": "2023-08-11"
}

Hi,

The reason api explorer is different to the python sdk is because python variables are named using snake_case whereas most other languages name variables using camelCase. The object and properties are the same in the python sdk just translated to snake_case.

Regards,
Declan

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