Resource: Views (preliminary)

Topics:

Actions

  • - (Object) index

Url:

  • [GET] /rest/v1/report/views?[arguments]
Note:

This action requires admin access.

Note:

The maximum date range (from/to) is limited to one year.

Returns the total number of content views grouped by device model or account.

Arguments:

  • (String) from

    Begin date in iso8601 format.

  • (String) to

    End date in iso8601 format.

  • (String) group_by

    (optional) Group view counts [values: ‘none’ (default - no grouping), ‘device’, ‘account’, ‘offer’].

  • (Integer) offer_id

    (optional) Filters accounts by offer ID, must be used with group_by=account.

  • (Integer) account_id

    (optional) Filters by account ID, must be used with group_by=account.

  • (DateTime) account_created_at_from

    (optional) Filter by start of account created_at date, must be used with group_by=account.

  • (DateTime) account_created_at_to

    (optional) Filter by end of account created_at date, must be used with group_by=account.

Example Request:

https://service_name.synctv.com/rest/v1/report/views?from=2011-11-07T00:00:00Z&to=2011-12-07T00:00:00Z&group_by=device

https://service_name.synctv.com/rest/v1/report/views?from=2011-11-07T00:00:00Z&to=2011-12-07T00:00:00Z&group_by=account

https://service_name.synctv.com/rest/v1/report/views?from=2011-11-07T00:00:00Z&to=2011-12-07T00:00:00Z&group_by=offer

Example Response:

Group by none example
<ssap>
  <response>
    <message>Successfully completed.</message>
     <count>4910</count>
     <code>1</code>
  </response>
  <version>0.5</version>
  <views>
    <view>
      <episode_name>episode-1</episode_name>
      <episode_id>1</episode_id>
      <episode_number>1</episode_number>
      <season_name>volume-1</season_name>
      <season_number>1</season_number>
      <season_id>1</season_id>
      <show_name>show-1</show_name>
      <show_id>1</show_id>
      <total>12</total> 
    </view>
  </views>
</ssap>

Group by device example
<ssap>
  <response>
    <code>1</code>
    <message>Successfully completed.</message>
    <count>1</count>
  </response>
  <version>0.5</version>
  <views>
    <view>
      <episode_name>episode-1</episode_name>
      <episode_id>1</episode_id>
      <episode_number>1</episode_number>
      <season_name>volume-1</season_name>
      <season_number>1</season_number>
      <season_id>1</season_id>
      <show_name>show-1</show_name>
      <show_id>1</show_id>
      <devices>
        <device>
          <name>iPhone</name>
          <total>5</total>
        </device>
        <device>
          <name>XBox</name>
          <total>7</total>
        </device>
      </devices>
    </view>
  </views>
</ssap>

Group by account example
<ssap>
  <response>
    <message>Successfully completed.</message>
     <count>4910</count>
     <code>1</code>
  </response>
  <version>0.5</version>
  <views>
    <view>
      <episode_name>episode-1</episode_name>
      <episode_id>1</episode_id>
      <episode_number>1</episode_number>  
      <season_name>volume-1</season_name>
      <season_number>1</season_number>
      <season_id>1</season_id>
      <show_name>show-1</show_name>
      <show_id>1</show_id>
      <accounts>
        <account>
          <email>user1@synctv.com</email>
          <id type="integer">12345</id>
          <total>10</total>
        </account>
        <account>
          <email>user2@synctv.com</email>
          <id type="integer">23456</id>
          <total>2</total>
        </account>
      </accounts>
    </view>
  </views>
</ssap>

Group by offer example
<ssap>
 <response>
   <code>1</code>
   <message>Successfully completed.</message>
   <count>1</count>
 </response>
 <views type="array">
   <view>
     <offers type="array">
       <offer>
         <total>5</total>
         <offer_id>1</offer_id>
       </offer>
     </offers>
     <episode_name>episode-31</episode_name>
     <show_name>show-6</show_name>
     <episode_number>31</episode_number>
     <season_number>16</season_number>
     <season_id>16</season_id>
     <episode_id>31</episode_id>
     <season_name>volume-16</season_name>
     <show_id>6</show_id>
   </view>
  </views>
 <version>0.5</version>
</ssap>

Response Fields:

  • (Array) views

    list of content views.

  • (String) episode_name

    The name of the episode.

  • (Integer) episode_id

    The id of the episode.

  • (Integer) episode_number

    The sequental number of the episode.

  • (String) season_name

    The name of the season.

  • (Integer) season_number

    The sequental number of season.

  • (Integer) season_id

    The id of the season.

  • (String) show_name

    The name of the show.

  • (Integer) show_id

    The id of the show.

  • (Integer) total

    The total number of views.

  • (Array) devices

    List of devices (if group_by=device).

  • (Array) accounts

    List of accounts (if group_by=account).