Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Introduction

...

It is possible to show to the user existing licenses and filter them by status. Client can filter licenses on it's side by next attributes:

  • status in [PROCESSING, CHECK_INVALID, ORDER_ERROR, ACTIVE, EXPIRED, SUSPENDED, SUSPENDEDADMIN]
  • start_date - when the license was activated, in unix epoch timestamp
  • end_date - when the license is going to be deactivated, in unix epoch timestamp

Every license object from returned list include product for which the license was issued

Client may obtain a list of products to combine with a list of licenses to show to the end-user.

Use cases

Let user select product and purchase it

...

Code Block
themeMidnight
titleGet all products response
collapsetrue
{
  "data": [
    {
      "id": "41",
      "type": "Product",
      "attributes": {
        "title": "Sport channels meagpack",
        "description": "Complete collection for all sports channels",
        "type": "CHANNEL_GROUP",
        "is_premium": true
      },
      "relationships": {
        "live": {
          "data": [
            {
              "id": "42",
              "type": "Channel"
            }
          ]
        },
        "catchup": {
          "data": [
            {
              "id": "42",
              "type": "Channel"
            }
          ]
        },
        "npvr": {
          "data": [
            {
              "id": "42",
              "type": "Channel"
            }
          ]
        },
        "startover": {
          "data": [
            {
              "id": "42",
              "type": "Channel"
            }
          ]
        }
      }
    }
  ]
}

...

The 'type' attribute could be one of:

Value in API

Service description

CHANNELThe product grants to user ability to watch associated channel
PVRThe product grants to user ability to record associated channel to their cloud storage account
CATCHUPThe product grants to user ability to watch programs that aired previously and are still within the defined catchup window for associated channel
STARTOVERThe product grants to user ability to restart a live program on associated channel from the beginning
CHANNEL_GROUPThe product is a collection of several channels with different services available for each channel, in other words a mix of all types above.

The 'relationships' here are same as defined at Channel API. If the channel is listed in relationship section then this service for that channel is available.


Value in API

Service description

liveThe user may watch this channel as a live stream
npvrThe user is allowed to record this channel to their cloud storage account
catchupThe user is permitted to watch programs that aired previously and are still within the defined catchup window (typically 2 weeks)
startoverThe user is permitted to restart a live program from the beginning.

Having this data should be enough to represent available products and what channels and services those provide to user.

...

When client can requests 'Get user licenses' endpoint response received contains all of user licenses and also includes all associated products.

...

themeMidnight
titleGet user licenses response

...

 From here licenses could be combined with it's associated products by id, filtered by status (for example to show only active) and represented to end-user, those which are close to expire could be spotted via stop_date and marked with some warning.

Code Block
themeMidnight
titleGet user licenses response
collapsetrue
{
  "data": [
    {
      "id": "42",
      "type": "License",
      "attributes": {
        "status": "ACTIVE",
        "start_date": 1523268666,
        "stop_date": 1523268698
      },
      "relationships": {
        "user": {
          "data": {
            "id": "41",
            "type": "User"
          }
        },
        "product": {
          "data": {
            "id": "41",
            "type": "Product"
          }
        }
      },
      "links": {
        "self": "https://boox.fi/api/user/waqqas.jabbar@gmail.com/license/10"
      }
    }
  ],
  "included": [
    {
      "id": "41",
      "type": "Product",
      "attributes": {
        "title": "Sport channels meagpack",
        "description": "Complete collection fo all sports channels",
        "type": "CHANNEL_GROUP",
        "is_premium": true
      },
      "relationships": {
        "live": {
          "data": [
            {
              "id": "42",
              "type": "Channel"
            }
          ]
        },
        "catchup": {
          "data": [
            {
              "id": "42",
              "type": "Channel"
            }
          ]
        },
        "npvr": {
          "data": [
            {
              "id": "42",
              "type": "Channel"
            }
          ]
        },
        "startover": {
          "data": [
            {
              "id": "42",
              "type": "Channel"
            }
          ]
        }
      }
    }
  ]
}

...