:doc:`WorkDocs <../../workdocs>` / Client / search_resources

****************
search_resources
****************



.. py:method:: WorkDocs.Client.search_resources(**kwargs)

  

  Searches metadata and the content of folders, documents, document versions, and comments.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/workdocs-2016-05-01/SearchResources>`_  


  **Request Syntax**
  ::

    response = client.search_resources(
        AuthenticationToken='string',
        QueryText='string',
        QueryScopes=[
            'NAME'|'CONTENT',
        ],
        OrganizationId='string',
        AdditionalResponseFields=[
            'WEBURL',
        ],
        Filters={
            'TextLocales': [
                'AR'|'BG'|'BN'|'DA'|'DE'|'CS'|'EL'|'EN'|'ES'|'FA'|'FI'|'FR'|'HI'|'HU'|'ID'|'IT'|'JA'|'KO'|'LT'|'LV'|'NL'|'NO'|'PT'|'RO'|'RU'|'SV'|'SW'|'TH'|'TR'|'ZH'|'DEFAULT',
            ],
            'ContentCategories': [
                'IMAGE'|'DOCUMENT'|'PDF'|'SPREADSHEET'|'PRESENTATION'|'AUDIO'|'VIDEO'|'SOURCE_CODE'|'OTHER',
            ],
            'ResourceTypes': [
                'FOLDER'|'DOCUMENT'|'COMMENT'|'DOCUMENT_VERSION',
            ],
            'Labels': [
                'string',
            ],
            'Principals': [
                {
                    'Id': 'string',
                    'Roles': [
                        'VIEWER'|'CONTRIBUTOR'|'OWNER'|'COOWNER',
                    ]
                },
            ],
            'AncestorIds': [
                'string',
            ],
            'SearchCollectionTypes': [
                'OWNED'|'SHARED_WITH_ME',
            ],
            'SizeRange': {
                'StartValue': 123,
                'EndValue': 123
            },
            'CreatedRange': {
                'StartValue': datetime(2015, 1, 1),
                'EndValue': datetime(2015, 1, 1)
            },
            'ModifiedRange': {
                'StartValue': datetime(2015, 1, 1),
                'EndValue': datetime(2015, 1, 1)
            }
        },
        OrderBy=[
            {
                'Field': 'RELEVANCE'|'NAME'|'SIZE'|'CREATED_TIMESTAMP'|'MODIFIED_TIMESTAMP',
                'Order': 'ASC'|'DESC'
            },
        ],
        Limit=123,
        Marker='string'
    )
    
  :type AuthenticationToken: string
  :param AuthenticationToken: 

    Amazon WorkDocs authentication token. Not required when using Amazon Web Services administrator credentials to access the API.

    

  
  :type QueryText: string
  :param QueryText: 

    The String to search for. Searches across different text fields based on request parameters. Use double quotes around the query string for exact phrase matches.

    

  
  :type QueryScopes: list
  :param QueryScopes: 

    Filter based on the text field type. A Folder has only a name and no content. A Comment has only content and no name. A Document or Document Version has a name and content

    

  
    - *(string) --* 

    

  :type OrganizationId: string
  :param OrganizationId: 

    Filters based on the resource owner OrgId. This is a mandatory parameter when using Admin SigV4 credentials.

    

  
  :type AdditionalResponseFields: list
  :param AdditionalResponseFields: 

    A list of attributes to include in the response. Used to request fields that are not normally returned in a standard response.

    

  
    - *(string) --* 

    

  :type Filters: dict
  :param Filters: 

    Filters results based on entity metadata.

    

  
    - **TextLocales** *(list) --* 

      Filters by the locale of the content or comment.

      

    
      - *(string) --* 

      
  
    - **ContentCategories** *(list) --* 

      Filters by content category.

      

    
      - *(string) --* 

      
  
    - **ResourceTypes** *(list) --* 

      Filters based on entity type.

      

    
      - *(string) --* 

      
  
    - **Labels** *(list) --* 

      Filter by labels using exact match.

      

    
      - *(string) --* 

      
  
    - **Principals** *(list) --* 

      Filter based on UserIds or GroupIds.

      

    
      - *(dict) --* 

        Filter based on UserIds or GroupIds.

        

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

          UserIds or GroupIds.

          

        
        - **Roles** *(list) --* 

          The Role of a User or Group.

          

        
          - *(string) --* 

          
      
      
  
    - **AncestorIds** *(list) --* 

      Filter based on resource’s path.

      

    
      - *(string) --* 

      
  
    - **SearchCollectionTypes** *(list) --* 

      Filter based on file groupings.

      

    
      - *(string) --* 

      
  
    - **SizeRange** *(dict) --* 

      Filter based on size (in bytes).

      

    
      - **StartValue** *(integer) --* 

        The size start range (in bytes).

        

      
      - **EndValue** *(integer) --* 

        The size end range (in bytes).

        

      
    
    - **CreatedRange** *(dict) --* 

      Filter based on resource’s creation timestamp.

      

    
      - **StartValue** *(datetime) --* 

        Timestamp range start value (in epochs)

        

      
      - **EndValue** *(datetime) --* 

        Timestamp range end value (in epochs).

        

      
    
    - **ModifiedRange** *(dict) --* 

      Filter based on resource’s modified timestamp.

      

    
      - **StartValue** *(datetime) --* 

        Timestamp range start value (in epochs)

        

      
      - **EndValue** *(datetime) --* 

        Timestamp range end value (in epochs).

        

      
    
  
  :type OrderBy: list
  :param OrderBy: 

    Order by results in one or more categories.

    

  
    - *(dict) --* 

      The result of the sort operation.

      

    
      - **Field** *(string) --* 

        Sort search results based on this field name.

        

      
      - **Order** *(string) --* 

        Sort direction.

        

      
    

  :type Limit: integer
  :param Limit: 

    Max results count per page.

    

  
  :type Marker: string
  :param Marker: 

    The marker for the next set of results.

    

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

    
    ::

      {
          'Items': [
              {
                  'ResourceType': 'DOCUMENT'|'FOLDER'|'COMMENT'|'DOCUMENT_VERSION',
                  'WebUrl': 'string',
                  'DocumentMetadata': {
                      'Id': 'string',
                      'CreatorId': 'string',
                      'ParentFolderId': 'string',
                      'CreatedTimestamp': datetime(2015, 1, 1),
                      'ModifiedTimestamp': datetime(2015, 1, 1),
                      'LatestVersionMetadata': {
                          'Id': 'string',
                          'Name': 'string',
                          'ContentType': 'string',
                          'Size': 123,
                          'Signature': 'string',
                          'Status': 'INITIALIZED'|'ACTIVE',
                          'CreatedTimestamp': datetime(2015, 1, 1),
                          'ModifiedTimestamp': datetime(2015, 1, 1),
                          'ContentCreatedTimestamp': datetime(2015, 1, 1),
                          'ContentModifiedTimestamp': datetime(2015, 1, 1),
                          'CreatorId': 'string',
                          'Thumbnail': {
                              'string': 'string'
                          },
                          'Source': {
                              'string': 'string'
                          }
                      },
                      'ResourceState': 'ACTIVE'|'RESTORING'|'RECYCLING'|'RECYCLED',
                      'Labels': [
                          'string',
                      ]
                  },
                  'FolderMetadata': {
                      'Id': 'string',
                      'Name': 'string',
                      'CreatorId': 'string',
                      'ParentFolderId': 'string',
                      'CreatedTimestamp': datetime(2015, 1, 1),
                      'ModifiedTimestamp': datetime(2015, 1, 1),
                      'ResourceState': 'ACTIVE'|'RESTORING'|'RECYCLING'|'RECYCLED',
                      'Signature': 'string',
                      'Labels': [
                          'string',
                      ],
                      'Size': 123,
                      'LatestVersionSize': 123
                  },
                  'CommentMetadata': {
                      'CommentId': 'string',
                      'Contributor': {
                          'Id': 'string',
                          'Username': 'string',
                          'EmailAddress': 'string',
                          'GivenName': 'string',
                          'Surname': 'string',
                          'OrganizationId': 'string',
                          'RootFolderId': 'string',
                          'RecycleBinFolderId': 'string',
                          'Status': 'ACTIVE'|'INACTIVE'|'PENDING',
                          'Type': 'USER'|'ADMIN'|'POWERUSER'|'MINIMALUSER'|'WORKSPACESUSER',
                          'CreatedTimestamp': datetime(2015, 1, 1),
                          'ModifiedTimestamp': datetime(2015, 1, 1),
                          'TimeZoneId': 'string',
                          'Locale': 'en'|'fr'|'ko'|'de'|'es'|'ja'|'ru'|'zh_CN'|'zh_TW'|'pt_BR'|'default',
                          'Storage': {
                              'StorageUtilizedInBytes': 123,
                              'StorageRule': {
                                  'StorageAllocatedInBytes': 123,
                                  'StorageType': 'UNLIMITED'|'QUOTA'
                              }
                          }
                      },
                      'CreatedTimestamp': datetime(2015, 1, 1),
                      'CommentStatus': 'DRAFT'|'PUBLISHED'|'DELETED',
                      'RecipientId': 'string',
                      'ContributorId': 'string'
                  },
                  'DocumentVersionMetadata': {
                      'Id': 'string',
                      'Name': 'string',
                      'ContentType': 'string',
                      'Size': 123,
                      'Signature': 'string',
                      'Status': 'INITIALIZED'|'ACTIVE',
                      'CreatedTimestamp': datetime(2015, 1, 1),
                      'ModifiedTimestamp': datetime(2015, 1, 1),
                      'ContentCreatedTimestamp': datetime(2015, 1, 1),
                      'ContentModifiedTimestamp': datetime(2015, 1, 1),
                      'CreatorId': 'string',
                      'Thumbnail': {
                          'string': 'string'
                      },
                      'Source': {
                          'string': 'string'
                      }
                  }
              },
          ],
          'Marker': 'string'
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **Items** *(list) --* 

        List of Documents, Folders, Comments, and Document Versions matching the query.

        
        

        - *(dict) --* 

          List of Documents, Folders, Comments, and Document Versions matching the query.

          
          

          - **ResourceType** *(string) --* 

            The type of item being returned.

            
          

          - **WebUrl** *(string) --* 

            The webUrl of the item being returned.

            
          

          - **DocumentMetadata** *(dict) --* 

            The document that matches the query.

            
            

            - **Id** *(string) --* 

              The ID of the document.

              
            

            - **CreatorId** *(string) --* 

              The ID of the creator.

              
            

            - **ParentFolderId** *(string) --* 

              The ID of the parent folder.

              
            

            - **CreatedTimestamp** *(datetime) --* 

              The time when the document was created.

              
            

            - **ModifiedTimestamp** *(datetime) --* 

              The time when the document was updated.

              
            

            - **LatestVersionMetadata** *(dict) --* 

              The latest version of the document.

              
              

              - **Id** *(string) --* 

                The ID of the version.

                
              

              - **Name** *(string) --* 

                The name of the version.

                
              

              - **ContentType** *(string) --* 

                The content type of the document.

                
              

              - **Size** *(integer) --* 

                The size of the document, in bytes.

                
              

              - **Signature** *(string) --* 

                The signature of the document.

                
              

              - **Status** *(string) --* 

                The status of the document.

                
              

              - **CreatedTimestamp** *(datetime) --* 

                The timestamp when the document was first uploaded.

                
              

              - **ModifiedTimestamp** *(datetime) --* 

                The timestamp when the document was last uploaded.

                
              

              - **ContentCreatedTimestamp** *(datetime) --* 

                The timestamp when the content of the document was originally created.

                
              

              - **ContentModifiedTimestamp** *(datetime) --* 

                The timestamp when the content of the document was modified.

                
              

              - **CreatorId** *(string) --* 

                The ID of the creator.

                
              

              - **Thumbnail** *(dict) --* 

                The thumbnail of the document.

                
                

                - *(string) --* 
                  

                  - *(string) --* 
            
          
              

              - **Source** *(dict) --* 

                The source of the document.

                
                

                - *(string) --* 
                  

                  - *(string) --* 
            
          
          
            

            - **ResourceState** *(string) --* 

              The resource state.

              
            

            - **Labels** *(list) --* 

              List of labels on the document.

              
              

              - *(string) --* 
          
        
          

          - **FolderMetadata** *(dict) --* 

            The folder that matches the query.

            
            

            - **Id** *(string) --* 

              The ID of the folder.

              
            

            - **Name** *(string) --* 

              The name of the folder.

              
            

            - **CreatorId** *(string) --* 

              The ID of the creator.

              
            

            - **ParentFolderId** *(string) --* 

              The ID of the parent folder.

              
            

            - **CreatedTimestamp** *(datetime) --* 

              The time when the folder was created.

              
            

            - **ModifiedTimestamp** *(datetime) --* 

              The time when the folder was updated.

              
            

            - **ResourceState** *(string) --* 

              The resource state of the folder.

              
            

            - **Signature** *(string) --* 

              The unique identifier created from the subfolders and documents of the folder.

              
            

            - **Labels** *(list) --* 

              List of labels on the folder.

              
              

              - *(string) --* 
          
            

            - **Size** *(integer) --* 

              The size of the folder metadata.

              
            

            - **LatestVersionSize** *(integer) --* 

              The size of the latest version of the folder metadata.

              
        
          

          - **CommentMetadata** *(dict) --* 

            The comment that matches the query.

            
            

            - **CommentId** *(string) --* 

              The ID of the comment.

              
            

            - **Contributor** *(dict) --* 

              The user who made the comment.

              
              

              - **Id** *(string) --* 

                The ID of the user.

                
              

              - **Username** *(string) --* 

                The login name of the user.

                
              

              - **EmailAddress** *(string) --* 

                The email address of the user.

                
              

              - **GivenName** *(string) --* 

                The given name of the user.

                
              

              - **Surname** *(string) --* 

                The surname of the user.

                
              

              - **OrganizationId** *(string) --* 

                The ID of the organization.

                
              

              - **RootFolderId** *(string) --* 

                The ID of the root folder.

                
              

              - **RecycleBinFolderId** *(string) --* 

                The ID of the recycle bin folder.

                
              

              - **Status** *(string) --* 

                The status of the user.

                
              

              - **Type** *(string) --* 

                The type of user.

                
              

              - **CreatedTimestamp** *(datetime) --* 

                The time when the user was created.

                
              

              - **ModifiedTimestamp** *(datetime) --* 

                The time when the user was modified.

                
              

              - **TimeZoneId** *(string) --* 

                The time zone ID of the user.

                
              

              - **Locale** *(string) --* 

                The locale of the user.

                
              

              - **Storage** *(dict) --* 

                The storage for the user.

                
                

                - **StorageUtilizedInBytes** *(integer) --* 

                  The amount of storage used, in bytes.

                  
                

                - **StorageRule** *(dict) --* 

                  The storage for a user.

                  
                  

                  - **StorageAllocatedInBytes** *(integer) --* 

                    The amount of storage allocated, in bytes.

                    
                  

                  - **StorageType** *(string) --* 

                    The type of storage.

                    
              
            
          
            

            - **CreatedTimestamp** *(datetime) --* 

              The timestamp that the comment was created.

              
            

            - **CommentStatus** *(string) --* 

              The status of the comment.

              
            

            - **RecipientId** *(string) --* 

              The ID of the user being replied to.

              
            

            - **ContributorId** *(string) --* 

              The ID of the user who made the comment.

              
        
          

          - **DocumentVersionMetadata** *(dict) --* 

            The document version that matches the metadata.

            
            

            - **Id** *(string) --* 

              The ID of the version.

              
            

            - **Name** *(string) --* 

              The name of the version.

              
            

            - **ContentType** *(string) --* 

              The content type of the document.

              
            

            - **Size** *(integer) --* 

              The size of the document, in bytes.

              
            

            - **Signature** *(string) --* 

              The signature of the document.

              
            

            - **Status** *(string) --* 

              The status of the document.

              
            

            - **CreatedTimestamp** *(datetime) --* 

              The timestamp when the document was first uploaded.

              
            

            - **ModifiedTimestamp** *(datetime) --* 

              The timestamp when the document was last uploaded.

              
            

            - **ContentCreatedTimestamp** *(datetime) --* 

              The timestamp when the content of the document was originally created.

              
            

            - **ContentModifiedTimestamp** *(datetime) --* 

              The timestamp when the content of the document was modified.

              
            

            - **CreatorId** *(string) --* 

              The ID of the creator.

              
            

            - **Thumbnail** *(dict) --* 

              The thumbnail of the document.

              
              

              - *(string) --* 
                

                - *(string) --* 
          
        
            

            - **Source** *(dict) --* 

              The source of the document.

              
              

              - *(string) --* 
                

                - *(string) --* 
          
        
        
      
    
      

      - **Marker** *(string) --* 

        The marker to use when requesting the next set of results. If there are no additional results, the string is empty.

        
  
  **Exceptions**
  
  *   :py:class:`WorkDocs.Client.exceptions.InvalidArgumentException`

  
  *   :py:class:`WorkDocs.Client.exceptions.UnauthorizedResourceAccessException`

  
  *   :py:class:`WorkDocs.Client.exceptions.UnauthorizedOperationException`

  
  *   :py:class:`WorkDocs.Client.exceptions.ServiceUnavailableException`

  