:doc:`ConnectCases <../../connectcases>` / Client / search_cases

************
search_cases
************



.. py:method:: ConnectCases.Client.search_cases(**kwargs)

  

  Searches for cases within their associated Cases domain. Search results are returned as a paginated list of abridged case documents.

   

  .. note::

    

    For ``customer_id`` you must provide the full customer profile ARN in this format: ``arn:aws:profile:your AWS Region:your AWS account ID:domains/profiles domain name/profiles/profile ID``.

    

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/connectcases-2022-10-03/SearchCases>`_  


  **Request Syntax**
  ::

    response = client.search_cases(
        domainId='string',
        maxResults=123,
        nextToken='string',
        searchTerm='string',
        filter={
            'field': {
                'equalTo': {
                    'id': 'string',
                    'value': {
                        'stringValue': 'string',
                        'doubleValue': 123.0,
                        'booleanValue': True|False,
                        'emptyValue': {}
                        ,
                        'userArnValue': 'string'
                    }
                },
                'contains': {
                    'id': 'string',
                    'value': {
                        'stringValue': 'string',
                        'doubleValue': 123.0,
                        'booleanValue': True|False,
                        'emptyValue': {}
                        ,
                        'userArnValue': 'string'
                    }
                },
                'greaterThan': {
                    'id': 'string',
                    'value': {
                        'stringValue': 'string',
                        'doubleValue': 123.0,
                        'booleanValue': True|False,
                        'emptyValue': {}
                        ,
                        'userArnValue': 'string'
                    }
                },
                'greaterThanOrEqualTo': {
                    'id': 'string',
                    'value': {
                        'stringValue': 'string',
                        'doubleValue': 123.0,
                        'booleanValue': True|False,
                        'emptyValue': {}
                        ,
                        'userArnValue': 'string'
                    }
                },
                'lessThan': {
                    'id': 'string',
                    'value': {
                        'stringValue': 'string',
                        'doubleValue': 123.0,
                        'booleanValue': True|False,
                        'emptyValue': {}
                        ,
                        'userArnValue': 'string'
                    }
                },
                'lessThanOrEqualTo': {
                    'id': 'string',
                    'value': {
                        'stringValue': 'string',
                        'doubleValue': 123.0,
                        'booleanValue': True|False,
                        'emptyValue': {}
                        ,
                        'userArnValue': 'string'
                    }
                }
            },
            'not': {'... recursive ...'},
            'tag': {
                'equalTo': {
                    'key': 'string',
                    'value': 'string'
                }
            },
            'andAll': [
                {'... recursive ...'},
            ],
            'orAll': [
                {'... recursive ...'},
            ]
        },
        sorts=[
            {
                'fieldId': 'string',
                'sortOrder': 'Asc'|'Desc'
            },
        ],
        fields=[
            {
                'id': 'string'
            },
        ]
    )
    
  :type domainId: string
  :param domainId: **[REQUIRED]** 

    The unique identifier of the Cases domain.

    

  
  :type maxResults: integer
  :param maxResults: 

    The maximum number of cases to return. When no value is provided, 25 is the default.

    

  
  :type nextToken: string
  :param nextToken: 

    The token for the next set of results. Use the value returned in the previous response in the next request to retrieve the next set of results.

    

  
  :type searchTerm: string
  :param searchTerm: 

    A word or phrase used to perform a quick search.

    

  
  :type filter: dict
  :param filter: 

    A list of filter objects.

    .. note::    This is a Tagged Union structure. Only one of the     following top level keys can be set: ``field``, ``not``, ``tag``, ``andAll``, ``orAll``. 

  
    - **field** *(dict) --* 

      A list of fields to filter on.

      .. note::    This is a Tagged Union structure. Only one of the     following top level keys can be set: ``equalTo``, ``contains``, ``greaterThan``, ``greaterThanOrEqualTo``, ``lessThan``, ``lessThanOrEqualTo``. 

    
      - **equalTo** *(dict) --* 

        Object containing field identifier and value information.

        

      
        - **id** *(string) --* **[REQUIRED]** 

          Unique identifier of a field.

          

        
        - **value** *(dict) --* **[REQUIRED]** 

          Union of potential field value types.

          .. note::    This is a Tagged Union structure. Only one of the     following top level keys can be set: ``stringValue``, ``doubleValue``, ``booleanValue``, ``emptyValue``, ``userArnValue``. 

        
          - **stringValue** *(string) --* 

            String value type.

            

          
          - **doubleValue** *(float) --* 

            Can be either null, or have a Double number value type. Only one value can be provided.

            

          
          - **booleanValue** *(boolean) --* 

            Can be either null, or have a Boolean value type. Only one value can be provided.

            

          
          - **emptyValue** *(dict) --* 

            An empty value.

            

          
          
          - **userArnValue** *(string) --* 

            Represents the user that performed the audit.

            

          
        
      
      - **contains** *(dict) --* 

        Object containing field identifier and value information.

        

      
        - **id** *(string) --* **[REQUIRED]** 

          Unique identifier of a field.

          

        
        - **value** *(dict) --* **[REQUIRED]** 

          Union of potential field value types.

          .. note::    This is a Tagged Union structure. Only one of the     following top level keys can be set: ``stringValue``, ``doubleValue``, ``booleanValue``, ``emptyValue``, ``userArnValue``. 

        
          - **stringValue** *(string) --* 

            String value type.

            

          
          - **doubleValue** *(float) --* 

            Can be either null, or have a Double number value type. Only one value can be provided.

            

          
          - **booleanValue** *(boolean) --* 

            Can be either null, or have a Boolean value type. Only one value can be provided.

            

          
          - **emptyValue** *(dict) --* 

            An empty value.

            

          
          
          - **userArnValue** *(string) --* 

            Represents the user that performed the audit.

            

          
        
      
      - **greaterThan** *(dict) --* 

        Object containing field identifier and value information.

        

      
        - **id** *(string) --* **[REQUIRED]** 

          Unique identifier of a field.

          

        
        - **value** *(dict) --* **[REQUIRED]** 

          Union of potential field value types.

          .. note::    This is a Tagged Union structure. Only one of the     following top level keys can be set: ``stringValue``, ``doubleValue``, ``booleanValue``, ``emptyValue``, ``userArnValue``. 

        
          - **stringValue** *(string) --* 

            String value type.

            

          
          - **doubleValue** *(float) --* 

            Can be either null, or have a Double number value type. Only one value can be provided.

            

          
          - **booleanValue** *(boolean) --* 

            Can be either null, or have a Boolean value type. Only one value can be provided.

            

          
          - **emptyValue** *(dict) --* 

            An empty value.

            

          
          
          - **userArnValue** *(string) --* 

            Represents the user that performed the audit.

            

          
        
      
      - **greaterThanOrEqualTo** *(dict) --* 

        Object containing field identifier and value information.

        

      
        - **id** *(string) --* **[REQUIRED]** 

          Unique identifier of a field.

          

        
        - **value** *(dict) --* **[REQUIRED]** 

          Union of potential field value types.

          .. note::    This is a Tagged Union structure. Only one of the     following top level keys can be set: ``stringValue``, ``doubleValue``, ``booleanValue``, ``emptyValue``, ``userArnValue``. 

        
          - **stringValue** *(string) --* 

            String value type.

            

          
          - **doubleValue** *(float) --* 

            Can be either null, or have a Double number value type. Only one value can be provided.

            

          
          - **booleanValue** *(boolean) --* 

            Can be either null, or have a Boolean value type. Only one value can be provided.

            

          
          - **emptyValue** *(dict) --* 

            An empty value.

            

          
          
          - **userArnValue** *(string) --* 

            Represents the user that performed the audit.

            

          
        
      
      - **lessThan** *(dict) --* 

        Object containing field identifier and value information.

        

      
        - **id** *(string) --* **[REQUIRED]** 

          Unique identifier of a field.

          

        
        - **value** *(dict) --* **[REQUIRED]** 

          Union of potential field value types.

          .. note::    This is a Tagged Union structure. Only one of the     following top level keys can be set: ``stringValue``, ``doubleValue``, ``booleanValue``, ``emptyValue``, ``userArnValue``. 

        
          - **stringValue** *(string) --* 

            String value type.

            

          
          - **doubleValue** *(float) --* 

            Can be either null, or have a Double number value type. Only one value can be provided.

            

          
          - **booleanValue** *(boolean) --* 

            Can be either null, or have a Boolean value type. Only one value can be provided.

            

          
          - **emptyValue** *(dict) --* 

            An empty value.

            

          
          
          - **userArnValue** *(string) --* 

            Represents the user that performed the audit.

            

          
        
      
      - **lessThanOrEqualTo** *(dict) --* 

        Object containing field identifier and value information.

        

      
        - **id** *(string) --* **[REQUIRED]** 

          Unique identifier of a field.

          

        
        - **value** *(dict) --* **[REQUIRED]** 

          Union of potential field value types.

          .. note::    This is a Tagged Union structure. Only one of the     following top level keys can be set: ``stringValue``, ``doubleValue``, ``booleanValue``, ``emptyValue``, ``userArnValue``. 

        
          - **stringValue** *(string) --* 

            String value type.

            

          
          - **doubleValue** *(float) --* 

            Can be either null, or have a Double number value type. Only one value can be provided.

            

          
          - **booleanValue** *(boolean) --* 

            Can be either null, or have a Boolean value type. Only one value can be provided.

            

          
          - **emptyValue** *(dict) --* 

            An empty value.

            

          
          
          - **userArnValue** *(string) --* 

            Represents the user that performed the audit.

            

          
        
      
    
    - **not** *(dict) --* 

      A filter for cases. Only one value can be provided.

      .. note::    This is a Tagged Union structure. Only one of the     following top level keys can be set: ``field``, ``not``, ``tag``, ``andAll``, ``orAll``. 

    
    - **tag** *(dict) --* 

      A list of tags to filter on.

      .. note::    This is a Tagged Union structure. Only one of the     following top level keys can be set: ``equalTo``. 

    
      - **equalTo** *(dict) --* 

        Object containing tag key and value information.

        

      
        - **key** *(string) --* 

          The tag key in the tag filter value.

          

        
        - **value** *(string) --* 

          The tag value in the tag filter value.

          

        
      
    
    - **andAll** *(list) --* 

      Provides "and all" filtering.

      

    
      - *(dict) --* 

        A filter for cases. Only one value can be provided.

        .. note::    This is a Tagged Union structure. Only one of the     following top level keys can be set: ``field``, ``not``, ``tag``, ``andAll``, ``orAll``. 

      
  
    - **orAll** *(list) --* 

      Provides "or all" filtering.

      

    
      - *(dict) --* 

        A filter for cases. Only one value can be provided.

        .. note::    This is a Tagged Union structure. Only one of the     following top level keys can be set: ``field``, ``not``, ``tag``, ``andAll``, ``orAll``. 

      
  
  
  :type sorts: list
  :param sorts: 

    A list of sorts where each sort specifies a field and their sort order to be applied to the results.

    

  
    - *(dict) --* 

      A structured set of sort terms.

      

    
      - **fieldId** *(string) --* **[REQUIRED]** 

        Unique identifier of a field.

        

      
      - **sortOrder** *(string) --* **[REQUIRED]** 

        A structured set of sort terms

        

      
    

  :type fields: list
  :param fields: 

    The list of field identifiers to be returned as part of the response.

    

  
    - *(dict) --* 

      Object for unique identifier of a field.

      

    
      - **id** *(string) --* **[REQUIRED]** 

        Unique identifier of a field.

        

      
    

  
  :rtype: dict
  :returns: 
    
    **Response Syntax**

    
    ::

      {
          'nextToken': 'string',
          'cases': [
              {
                  'caseId': 'string',
                  'templateId': 'string',
                  'fields': [
                      {
                          'id': 'string',
                          'value': {
                              'stringValue': 'string',
                              'doubleValue': 123.0,
                              'booleanValue': True|False,
                              'emptyValue': {},
                              'userArnValue': 'string'
                          }
                      },
                  ],
                  'tags': {
                      'string': 'string'
                  }
              },
          ],
          'totalCount': 123
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **nextToken** *(string) --* 

        The token for the next set of results. This is null if there are no more results to return.

        
      

      - **cases** *(list) --* 

        A list of case documents where each case contains the properties ``CaseId`` and ``Fields`` where each field is a complex union structure.

        
        

        - *(dict) --* 

          A list of items that represent cases.

          
          

          - **caseId** *(string) --* 

            A unique identifier of the case.

            
          

          - **templateId** *(string) --* 

            A unique identifier of a template.

            
          

          - **fields** *(list) --* 

            List of case field values.

            
            

            - *(dict) --* 

              Object for case field values.

              
              

              - **id** *(string) --* 

                Unique identifier of a field.

                
              

              - **value** *(dict) --* 

                Union of potential field value types.

                .. note::    This is a Tagged Union structure. Only one of the     following top level keys will be set: ``stringValue``, ``doubleValue``, ``booleanValue``, ``emptyValue``, ``userArnValue``.     If a client receives an unknown member it will     set ``SDK_UNKNOWN_MEMBER`` as the top level key,     which maps to the name or tag of the unknown     member. The structure of ``SDK_UNKNOWN_MEMBER`` is     as follows::

                                'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}


              
                

                - **stringValue** *(string) --* 

                  String value type.

                  
                

                - **doubleValue** *(float) --* 

                  Can be either null, or have a Double number value type. Only one value can be provided.

                  
                

                - **booleanValue** *(boolean) --* 

                  Can be either null, or have a Boolean value type. Only one value can be provided.

                  
                

                - **emptyValue** *(dict) --* 

                  An empty value.

                  
              
                

                - **userArnValue** *(string) --* 

                  Represents the user that performed the audit.

                  
            
          
        
          

          - **tags** *(dict) --* 

            A map of of key-value pairs that represent tags on a resource. Tags are used to organize, track, or control access for this resource.

            
            

            - *(string) --* 
              

              - *(string) --* 
        
      
      
    
      

      - **totalCount** *(integer) --* 

        The total number of cases that matched the search criteria.

        
  
  **Exceptions**
  
  *   :py:class:`ConnectCases.Client.exceptions.InternalServerException`

  
  *   :py:class:`ConnectCases.Client.exceptions.ResourceNotFoundException`

  
  *   :py:class:`ConnectCases.Client.exceptions.ValidationException`

  
  *   :py:class:`ConnectCases.Client.exceptions.ThrottlingException`

  
  *   :py:class:`ConnectCases.Client.exceptions.AccessDeniedException`

  