# Criteria for retrieving media information

The `criteria` object specifies what media information is returned and how the returned information is sorted.

The `criteria` object has three main properties: `Type`, `Filter`, and `Sort`. These are described in the following table. Properties enclosed in brackets are optional.

Table: Criteria object properties
Property | Description | Type | Value
--- | --- | --- | ---
`criteria.Type` | Specifies the type of media objects to retrieve. | string | Possible values: `"FileInfo"`
`criteria.Filter` | Specifies how the information to be retrieved is filtered. | object | Object with the properties specified below
`criteria.Filter.FileType` | Specifies the type of media files about which to retrieve information. | string | Possible values: `"Music"` `"Sound"` `"Image"` `"Video"` `"StreamingURL"`
`[criteria.Filter.Key]` | This property is used together with `Filter.StartRange` and optionally `Filter.EndRange` to specify a further filter criterion based on a media file property ("key"). If you specify this property, you must also specify `Filter.StartRange`. Note: If this property is not specified, then all files of `Filter.FileType` are fetched. For more information about keys, see Table: Keys for filtering and sorting. | string | Possible values: `"FileName"` `"FileExtension"` `"Drive"` `"FileSize"` `"FileDate"` `"MimeType"` `"FileNameAndPath"` `"SongName"` `"Artist"` `"Album"` `"Genre"` `"TrackNumber"` `"Composer"` `"LinkFirstURL"`
`[criteria.Filter.StartRange]` | Specifies the starting range and is valid for all key types. For example, if you set `Filter.Key` to `"FileName"`, specify the file name in this property and leave `Filter.EndRange` unspecified. This property is mandatory only if you specify `Filter.Key`. | string | Depends on `Filter.Key`
`[criteria.Filter.EndRange]` | Specifies the end range and is valid for the following keys: `FileSize` `FileDate` | string | Depends on `Filter.Key`
`[criteria.Sort]` | Specifies how the returned list of information is sorted. | object | Object with the properties specified below
`[criteria.Sort.Key]` | Specifies the key to sort by. For more information about keys, see Table: Keys for filtering and sorting. | string | Possible values: `"FileName"` `"FileExtension"` `"Drive"` `"FileSize"` `"FileDate"` `"MimeType"` `"FileNameAndPath"` `"SongName"` `"Artist"` `"Album"` `"Genre"` `"TrackNumber"` `"Composer"` `"LinkFirstURL"`
`[criteria.Sort.Order]` | Specifies the sort order. Note: By default, sorting is done in ascending order based on file name. | string | Possible values: `"Ascending"` `"Descending"`

The following table describes the possible values for `Filter.StartRange` and `Filter.EndRange` depending on the selected key.

Table: Keys for filtering and sorting
Key | Description | Value | Type
--- | --- | --- | ---
`FileName` | Filter/sort the result by file name. | Full file name | string
`FileExtension` | Filter/sort the result by file extension. | "." + file extension | string
`Drive` | Filter/sort the result by file drive. | Drive letter + ":" | string
`FileSize` | Filter/sort the result by file size. | File size in bytes Note: Start range and end range are needed. | string
`FileDate` | Filter/sort the result by file date. | File date as YYYYMMDD:HHMMSS Note: Start range and end range are needed. | string
`FileNameAndPath` | Filter/sort the result by full path and file name. | Full path including file name | string
`SongName` | Filter/sort the result by song name. | Full song name | string
`Artist` | Filter/sort the result by artist name. | Full artist name | string
`Album` | Filter/sort the result by album name. | Full album name | string
`Genre` | Filter/sort the result by genre. | Full genre name | string
`TrackNumber` | Filter/sort the result by track number. | Full track number | string
`Composer` | Filter/sort the result by composer. | Full composer name | string
`LinkFirstURL` | Filter/sort the result by URL. | Full URL of the streaming media file | string
`MimeType` | Filter/sort the result by MIME type. | MIME type For example: `image/jpg` | string