mellymell
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2018
07:22 PM
Self-Managed Content Availability To Subscribers
Forgive me if I'm posting a question that's been asked and answered, or to the wrong place but I figured this feature isn't available in Direct Publishing. I did a lot of searching for different terms via Google and this forum, but didn't seem to find what I'm looking for.
I will maintain a user database on my website that identifies which people have access to which content. I don't need that managed by Roku because that'll just add a layer necessitating cumbersome data syncing. Is there a mechanism for having Roku query my system once they've been authenticated and their device is linked to their account in my database, for showing them specific content--specific libraries or albums or whatever they're called? So, more content for a gold user than a silver user, or for one who's been with me for 1 month vs 6 months? I mean, I know the feature is available because a hell of a lot of channel providers use it (e.g. SlingTV Packages). I just can't seem to find info on it.
I just need to know how to make Roku query my system, providing, I would imagine, just their device ID or authentication ID or whatever, and then I provide the albums/libraries or whatever that they should have access to...
Thanks in advance!!!
I will maintain a user database on my website that identifies which people have access to which content. I don't need that managed by Roku because that'll just add a layer necessitating cumbersome data syncing. Is there a mechanism for having Roku query my system once they've been authenticated and their device is linked to their account in my database, for showing them specific content--specific libraries or albums or whatever they're called? So, more content for a gold user than a silver user, or for one who's been with me for 1 month vs 6 months? I mean, I know the feature is available because a hell of a lot of channel providers use it (e.g. SlingTV Packages). I just can't seem to find info on it.
I just need to know how to make Roku query my system, providing, I would imagine, just their device ID or authentication ID or whatever, and then I provide the albums/libraries or whatever that they should have access to...
Thanks in advance!!!
2 REPLIES 2
sdpetersen
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-26-2018
06:53 AM
Re: Self-Managed Content Availability To Subscribers
Yes, this happens all day long in pretty much every app or channel.
What you need first is an API to your website/database. It's essentially a page that accepts user accounts and returns the list of albums/movies, etc that they have access to in a program-legible format (I'd recommend JSON as your format, as it's easy to work with and is pretty universally accepted). Your website/database would manage the user account and make the decision about what content to serve the user through the API, based on the credentials the Roku Channel sent (username + password, device ID, auth ID, etc).
Then you'd need a function in your Roku channel to call that API and process the result:
You'd call this API like so:
Where "customer-albums" is your action the API is calling. Then do some processing on oneRow to add it to your interface.
This is an over simplified API call to get you going. Ideally, you'd also want to add some level of security to the API, because as it is, any one anywhere in the world could call this API and harvest the data from your website (limited by what the API is willing to output).
One thing to note: Brightscript will not allow you to make an API call like this within your main script, so you have to create a "sub-script" called a Task and launch it from the main script to gather this information.
What you need first is an API to your website/database. It's essentially a page that accepts user accounts and returns the list of albums/movies, etc that they have access to in a program-legible format (I'd recommend JSON as your format, as it's easy to work with and is pretty universally accepted). Your website/database would manage the user account and make the decision about what content to serve the user through the API, based on the credentials the Roku Channel sent (username + password, device ID, auth ID, etc).
Then you'd need a function in your Roku channel to call that API and process the result:
Function APICall(action as string) 'This function retrieves and parses the feed and returns the result
account = [INSERT GLOBAL VARIABLE HERE]
api = CreateObject("roUrlTransfer") 'component used to transfer data to/from remote servers
api.SetCertificatesFile("common:/certs/ca-bundle.crt")
api.AddHeader("X-Roku-Reserved-Dev-Id", "") 'Headers for the call
api.InitClientCertificates()
requestUrl = Substitute("https:/[Your Website API URL]?accountID={0}&action={1}", account, action) 'The API call to retrieve user information
api.SetUrl(requestUrl)
rsp = api.GetToString() 'convert the response to a string
responseJSON = parseJSON(rsp) 'parse the JSON string to an Associative Array
return responseJSON 'Return the result for additional processing
End Function
You'd call this API like so:
oneRow = APICall("customer-albums")
Where "customer-albums" is your action the API is calling. Then do some processing on oneRow to add it to your interface.
This is an over simplified API call to get you going. Ideally, you'd also want to add some level of security to the API, because as it is, any one anywhere in the world could call this API and harvest the data from your website (limited by what the API is willing to output).
One thing to note: Brightscript will not allow you to make an API call like this within your main script, so you have to create a "sub-script" called a Task and launch it from the main script to gather this information.
mellymell
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2018
12:02 PM
Re: Self-Managed Content Availability To Subscribers
That is very helpful. Thank you!
Is there a particular name for this functionality, so that I do better when attempting to search for solutions, coding examples, etc?
Is there a particular name for this functionality, so that I do better when attempting to search for solutions, coding examples, etc?