Custom metadata cm
The service allows clients to make use of both standard and custom fields in both queries and decision-making. The standard fields are always available for any stream (as they are either required for stream creation or generated by the server):
- application
- mvpd
- accountId
- streamId
- streamStart
- initiator
The custom fields are any key/value pairs passed in on stream initialization, as either form or query string parameters. Both the standard and custom fields can then be used in the following scenarios (for details, see the actual documentation for the involved API resources below):
- Requesting extra fields (via the fields query string parameter) when fetching the stream list for an account (the /streams resource)
- Breaking down the account activity by specifying the dimensions to group by (the /activity resource)
- Defining server-side policies based on field values or cardinalities (the examples use pseudo-SQL just for clarity):
- Configure a policy to only apply to specific field values (e.g. a dedicated iOS policy: WHERE osType IS ‘iOS’)
- Limit the number of distinct values for a given field (e.g. no more than X distinct devices: HAVING DISTINCT COUNT(deviceId) >= 2)
- Limit the number of active streams per field value (e.g. no more than X active streams for a single device type: GROUP BY deviceType HAVING COUNT(streamId) >= 3)
Based on these key/values being sent, different rules can be established. This could be something along these lines :
-
The customer decides that he would like to send the parameter group, which will have as values “SPORTS” and “KIDS”.
-
Then the app would need to do this:
- For sports channels, at stream initialization the app would be sending type=SPORTS as a query parameter
- For channels with kids related content, at stream initialization the app would be sending type=KIDS as a query parameter
-
Then a policy like this could be defined:
GROUP by type HAVING COUNT(streamID) < 4) IF type=KIDSGROUP by type HAVING COUNT(streamID) < 2) IF type=SPORTS
-
This would basically mean that when a user is watching sports, he/she cannot do it on more than 1 device, however when the user watches kids content, viewing is allowed on max 3 devices.