Get media time groups

Contents

mediaTimeGroups API aggregates group of media files based on the time unit. You can create a media view showing your files organized by a month, a year or a day. For example, if you send a request for images (mimeGroups=image) arranged by a month (unit=month), it will return the image count that you have on the device for each month.

Only the groups with a positive count will be returned. Most users may want to use an endTime that falls on a calendar boundary such as January 1st midnight (00:00:00Z).

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

Request Syntax


GET /v1/mediaTimeGroups



Request Headers

Parameter Description Required
Accept-Encoding Use value gzip in Accept-Encoding header to compress the response data. This reduces network traffic and improves response time.

Value of type: string
false
Authorization An 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-Match A previous response ETag or *. Return the object only if its entity tag (ETag) is the same as the one specified.

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

Value of type: string
false


Request Query Parameters

Parameter Description Required
endTime The inclusive newest time to bound for the groups.

Value of type: dateTime
true
fields The fields to return.

Value of type: csv

Default: All fields
false
limit The page size limit.

Value of type: integer

Default: 20
false
mimeGroups The group of the mimeType's to include. This is the RFC type such as image or application.

Value of type: csv
true
pageToken The pageToken obtained from the last response.

Value of type: string
false
pretty Whether 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
unit The duration to include for each group. Valid values are year, month, day or hour calculated from the endTime.

Value of type: string
true


200 Response

OK

Response Headers

Parameter Description Required
Content-Type Indicates the media type for the message body. The value will be application/json. false
Etag An eTag (entity tag) is an HTTP response header used to determine the change in file metadata and content. false


Response Payload

Parameter Description Required
mediaTimeGroups An array of mediaTimeGroups.

Object of type: MediaTimeGroup
false


Example

Sample request to get media time groups based on the time unit.

Request


GET /sdk/v1/mediaTimeGroups?mimeGroups=image&limit=3&endTime=2017-01-01T00:00:00Z&unit=hour&fields=count,minTime,maxTime HTTP/1.1
Host: Endpoint-URL
Authorization: Bearer 8fc0180d-7ccc-4072-b923-93643201cf9e

Response


HTTP/1.1 200 OK
Content-Type: application/json
Etag: "nbt83IkgefJTl-JOWIBYbQ"
Vary: Origin
Date: Fri, 09 Sep 2016 23:42:59 GMT
Content-Length: 324

{
  "mediaTimeGroups": [
    {
      "count": 115,
      "minTime": "2016-09-13T00:41:29.678Z",
      "maxTime": "2016-09-13T00:44:55.941Z"
    },
    {
      "count": 1,
      "minTime": "2016-08-26T18:29:41Z",
      "maxTime": "2016-08-26T18:29:41Z"
    },
    {
      "count": 2,
      "minTime": "2009-10-18T14:36:49Z",
      "maxTime": "2009-10-18T14:45:52Z"
    }
  ]
}

Have question about this section?