Sathishkumar_J | 2023-09-04 14:24:51 UTC | #1
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"
Jerome.Saint-Marc | 2023-09-04 14:47:41 UTC | #2
Hello,
See TimeOffRequestQueryBody for the correct parameter names.
body.daterange = PureCloudPlatformClientV2.LocalDateRange() body.daterange.startdate = '2023-08-21' body.daterange.end_date = '2023-08-30'
Regards,
Sathishkumar_J | 2023-09-04 14:53:39 UTC | #3
Thanks Jerome. It worked.
Note: In API explorer it is given as "dateRange": { "startDate": "2023-07-21", "endDate": "2023-08-11" }
Declan_ginty | 2023-09-04 15:00:04 UTC | #4
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
system | 2023-10-05 15:00:21 UTC | #5
This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.
This post was migrated from the old Developer Forum.
ref: 21837