Legacy Dev Forum Posts

 View Only

Sign Up

Request Body - dateRanges for /api/v2/workforcemanagement/managementunits/{managementUnitId}/timeofflimits/values/query

  • 1.  Request Body - dateRanges for /api/v2/workforcemanagement/managementunits/{managementUnitId}/timeofflimits/values/query

    Posted 06-05-2025 18:09

    Sathishkumar_J | 2023-07-26 09:02:57 UTC | #1

    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 = apiinstance.postworkforcemanagementmanagementunittimeofflimitsvaluesquery(managementunitid, body=body) print(res.to_json())

    What should be the correct method to call dateRanges, please assist?


    Declan_ginty | 2023-07-26 10:01:02 UTC | #2

    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


    Sathishkumar_J | 2023-07-26 10:20:59 UTC | #3

    It worked. Thanks a lot Declan.

    Regards, Sathish


    system | 2023-08-26 10:21:40 UTC | #4

    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: 21160