GET/users/{userId}/drive/search

Search for files and folders, such as My Drive, collaborative drives, Team/Group Folder, Shared Folder, etc. that users can access.

Authorization

oauth2

OAuth 2.0 authentication.
For more information, see Authentication and Authorization.

Scope

file
file.read
group.folder
group.folder.read

HTTP Request

GEThttps://www.worksapis.com/v1.0/users/{userId}/drive/search

Path Parameters

ParameterTypeDescription
userId string 

User ID

  • Mail
  • Resource ID
  • External key in "externalKey:{externalKey}" format
  • me

required
example : me 

Query Parameters

ParameterTypeDescription
query string 

Search Term


required
example : Test 
queryFilters string 

Specify the fields to be searched for the search term, separated by commas (,).

  • fileName: Search file names
  • content: Search the contents of the file

default : fileName,content
example : fileName 
parentFileId string 

File ID of the folder to be searched


example : NzExNTMwMDF8MTQ2NzA1NjAxMDAwMHxGfDA 
fileTypes string 

The file types to be searched.
If no type is specified, all files will be searched.

  • AUDIO: Audio file
  • FILE: All fies except folder
  • DOC: Document file
  • ETC: Etc. file
  • EXE: Executable file
  • FOLDER: Folder
  • IMAGE: Image file
  • VIDEO: Video file
  • ZIP: Zip file

example : AUDIO 
startTime string 

Start date and time for searches based on modifiedTime

  • Format: YYYY-MM-DDThh:mm:ssTZD (the ‘+’ character is encoded as ‘%2B’)

example : 2023-06-05T10:54:10%2B09:00 
endTime string 

End date and time for searches based on modifiedTime

  • Format: YYYY-MM-DDThh:mm:ssTZD (the ‘+’ character is encoded as ‘%2B’)

example : 2023-06-10T10:54:10%2B09:00 
driveTypeFilters string 

Type of drive to search for, separated by a comma (,) when specifying multiple drives.
If not specified, all drives/folders with access issues are to be searched.

  • MY_DRIVE: My Drive
  • SHARE_DRIVE: Collaborative Drive.
  • CHANNEL_FOLDER: Team/Group/Channel Talkroom
  • SHARED_FOLDER: Shared Folder

example : MY_DRIVE,SHARE_DRIVE 
orderBy string 

Sorting method. Enter the sort criteria and order separated by a space (%20).
Example) fileName%20asc

  • Sort criteria
    • File: modifiedTime, fileName
  • Order
    • Ascending: asc
    • Descending: desc

example : modifiedTime%20desc 
cursor string 

Cursor


example : JlIBsfJogXpzDGY8OscZziqZpYqCAu3RbZbaFzBb1od6lWQtSdPUd2FIdCuaGgu8DA==
allowReserved : false 
count integer 

Number of items to get


default : 20
minimum : 1
maximum : 200
example : 20
format : int32 

Header Parameters

HeadertypeDescription
Authorization string 

Bearer {token}


required 

Response

HTTP 200

OK

PropertyTypeDescription
files array (File) 

Search result file list

 
responseMetaData object (responseMetaData) 

Response metadata

 

File

PropertyTypeDescription
accessedTime string 

Access date


readOnly : true 
createdTime string 

Creation date


readOnly : true 
modifiedTime string 

Update date


readOnly : true 
fileId string 

File ID


readOnly : true 
parentFileId string 

File ID of the parent folder


readOnly : true 
fileName string 

File name


readOnly : true 
fileSize integer 

File size


format : int64
readOnly : true 
filePath string 

File path


readOnly : true 
fileType string 

File type

  • AUDIO: Audio file
  • DOC: Document file
  • ETC: Etc. file
  • EXE: Executable file
  • FOLDER: Folder
  • IMAGE: Image file
  • VIDEO: Video file
  • ZIP: Zip file

Allowed values : AUDIO, DOC, ETC, EXE, FOLDER, IMAGE, VIDEO, ZIP 
hasPermission boolean 

Indicates whether an access permission is set for the file.


readOnly : true
nullable : false 
permissionRootFileId string 

Permission root folder ID


readOnly : true
nullable : true 
shared boolean 

Indicates whether the file is shared.


readOnly : true
nullable : false 
shareRootFileId string 

Root folder ID of the shared folder


readOnly : true
nullable : true 
resourceLocation integer 

Resource location code


format : int32
readOnly : true 
statuses array (FileStatus) 

File status


Allowed values : LOCKED, MALWARE, PROTECTED, IN_PROGRESS 
snippet string 

Body contents searched during body search


readOnly : true
nullable : true 
driveInfo object (driveInfo) 

Drive information for File

 

FileStatus

PropertyTypeDescription
FileStatus string 

File status

  • LOCKED: Locked file
  • MALWARE: Malware file
  • PROTECTED: File marked as Important
  • IN_PROGRESS: File being uploaded

Allowed values : LOCKED, MALWARE, PROTECTED, IN_PROGRESS 

driveInfo

PropertyTypeDescription
driveType string 

Drive Type

  • MY_DRIVE: My Drive
  • SHARED_FOLDER: Shared Folder
  • SHARE_DRIVE: Collaborative Drive
  • CHANNEL_FOLDER: Team/Group/Channel Folder

Allowed values : MY_DRIVE, SHARED_FOLDER, SHARE_DRIVE, CHANNEL_FOLDER 
id string 

ID corresponding to Drive Type


readOnly : true
nullable : true 

responseMetaData

PropertyTypeDescription
nextCursor string 

Cursor value for pagination


readOnly : true 

Response Example

example

1{2  "files": [3    {4      "fileId": "QDIxMDAwMDAwMDAwMTcwfDExODE1MDg3MzQ0NzJ8RHww",5      "parentFileId": "QDIxMDAwMDAwMDAwMTcwfDExNzgyODY2MjgxMDR8RHww",6      "resourceLocation": 24101,7      "fileSize": 10,8      "fileName": "works.txt",9      "filePath": "/ShareDriveName/works.txt",10      "fileType": "DOC",11      "createdTime": "2020-11-13T18:20:05+09:00",12      "modifiedTime": "2021-04-05T21:14:05+09:00",13      "accessedTime": "2021-04-05T21:14:05+09:00",14      "statuses": [],15      "hasPermission": false,16      "permissionRootFileId": null,17      "snippet": null,18      "driveInfo": {19        "driveType": "SHARE_DRIVE",20        "id": "@248080202002"21      }22    },23    {24      "fileId": "MTU1NzYwMDF8MzQ3MjQ3MTI0MDkxNzYzNTMzN3xEfDA",25      "parentFileId": "MTU1NzYwMDF8MzQ3MjQ3MTI0MDY1MTQxMTcyMHxEfDA",26      "resourceLocation": 24101,27      "fileSize": 0,28      "fileName": "worksFolder",29      "filePath": "/GroupFolderName/worksFolder/",30      "fileType": "FOLDER",31      "createdTime": "2020-11-13T18:20:05+09:00",32      "modifiedTime": "2021-04-05T21:14:05+09:00",33      "accessedTime": "2021-04-05T21:14:05+09:00",34      "statuses": [],35      "hasPermission": false,36      "permissionRootFileId": null,37      "snippet": null,38      "driveInfo": {39        "driveType": "CHANNEL_FOLDER",40        "id": "@93000099002912"41      }42    }43  ],44  "responseMetaData": {45    "nextCursor": "JlIBsfJogXpzDGY8OscZziqZpYqCAu3RbZbaFzBb1od6lWQtSdPUd2FIdCuaGgu8DA=="46  }47}