Legacy Dev Forum Posts

 View Only

Sign Up

  • 1.  Specify query operator

    Posted 06-05-2025 18:08

    vkondula | 2017-03-30 12:42:02 UTC | #1

    The PureCloudPlatformApiSdk.UserSearchCriteria class transforms operator to lowercase, which is denied as bad request.

    q = PureCloudPlatformApiSdk.UserSearchCriteria()
    q.value = "my@email.com"
    q.fields = ['email']
    q.operator = 'AND'
    q
    >>>{'end_value': None,
    >>>'fields': ['email'],
    >>>'group': None,
    >>>'operator': 'and',  #  <<<< lower case
    >>>'start_value': None,
    >>>'type': 'contains',
    >>>'value': 'my@email.com',
    >>>'values': None}
    body.query = [q]
    user = api.post_search(body)
    >>> {"status":400,"code":"invalid.value","message":"Value [and] is not valid for field type [Operator]. Allowable values are: AND, OR, NOT"}

    tim.smith | 2017-03-31 14:27:21 UTC | #2

    I've opened API-2452 to address this issue. It looks like enum members are being forced to lowercase incorrectly.


    tim.smith | 2017-04-28 16:02:33 UTC | #3

    This is fixed as of PureCloudPlatformClientV2 5.0.2. Example from my test:

    search_api = PureCloudPlatformClientV2.SearchApi()

    query = PureCloudPlatformClientV2.UserSearchCriteria() query.type = 'EXACT' query.value = 'my@email.com' query.fields = ['email'] query.operator = 'AND'

    body = PureCloudPlatformClientV2.SearchRequest() body.types = ['USERS'] body.query = [query]

    response = searchapi.postsearch(body) pprint(response)


    system | 2017-08-28 19:33:28 UTC | #4


    This post was migrated from the old Developer Forum.

    ref: 1121