Search files by parent and name


Searches for a file in a specified folder. This request requires you to pass the parentId of the folder and the name of the file in the request header.

Endpoint URL: {network.internalDNSName or network.proxyURL} received in DeviceInformation

Request Syntax

GET /v2/filesSearch/parentAndName


Request Headers

ParameterDescriptionRequired
Accept-EncodingRequest using the Accept-Encoding header, with a value of gzip to compress response data. This reduces network traffic and improves response time.

Value of type: string
false
AuthorizationAn access token with nas_read_only or nas_read_write scope as well as the File Permission with value ReadFile or FileOwner for the file or a parent.

Value of type: string
true
If-MatchA previous response ETag or *. Returns the object only if its entity tag (ETag) is the same as the one specified.

Value of type: string
false
If-None-MatchA previous response ETag or *. Returns the object only if its entity tag (ETag) is different from the one specified.

Value of type: string
false


Request Query Parameters

ParameterDescriptionRequired
fieldsThe fields to return.

Value of type: csv

Default: All fields
false
nameThe name of the file to search for.

Value of type: string
true
parentIDThe ID of the parent folder within which to search. The value of root retrieves the user's root-directory. The value of sysroot retrieves system's root-directory. The value of trash retrieves the contents of pending deletions.

Value of type: string

Default: sysroot
false
prettyWhether to pretty print the response. It refers to the process of displaying source code or other items in a presentable way.

Value of type: boolean

Default: false
false


200 Response

OK

Response Headers

ParameterDescriptionRequired
Content-TypeIndicates the media type for the message body. Specify application/json as the content-type.false
EtagAn eTag (entity tag) is an HTTP response header used to determine the change in file metadata and content.false


Response Payload

ParameterDescriptionRequired
FileThe File metadata.

Object of type: File
true


Example

Sample request to search for a file having a specified parentID and name.

Request

GET /sdk/v2/filesSearch/parentAndName?parentID=0cDLqRwqT5sh6iaeNt24k7CaFGmZlSsITSVtg2ct&name=sdk%20image.jpg HTTP/1.1Host: Endpoint-URLAuthorization: Bearer 619085ea-65cb-4b3a-819c-6ac92a3a30f8

Response

HTTP/1.1 200 OKContent-Type: application/jsonEtag: "wYVyMtluyc7ghOO9k5irPA"Vary: OriginDate: Mon, 29 Aug 2016 22:17:58 GMTContent-Length: 706{  "id": "UirCkRtlp8gdUvqzk94ekXg6ElJWCYAAGRIgNhE-",  "parentID": "0cDLqRwqT5sh6iaeNt24k7CaFGmZlSsITSVtg2ct",  "eTag": "\"Bg\"",  "size": 6554,  "mimeType": "image/jpeg",  "mimeTypes": ["image/jpeg"],  "name": "sdk image漢.jpg",  "mTime": "2016-08-29T21:43:29.655Z",  "cTime": "2016-08-29T21:43:29.655Z",  "extension": ".jpg",  "image": {    "date": "2015-04-30T10:37:58Z",    "width": 20,    "height": 27,    "cameraMake": "sdk camera make漢",    "cameraModel": "sdk camera model漢",    "aperture": 2.4,    "exposureTime": 0.016666666,    "isoSpeed": 64,    "focalLength": 4.12,    "flashFired": false,    "orientation": 1,    "latitude": 37.506277777777775,    "longitude": -121.92104444444445,    "altitude": 58.2106135986733  },  "publiclyShared": false,  "privatelyShared": false}