Method to check end user's subscription status?

Want to write your own code to work with a HDHomeRun or work with the HDHomeRun DVR? We are happy to help with concepts, APIs, best practices.
Post Reply
djp952
Posts: 898
Joined: Wed Oct 01, 2008 8:46 pm
Device ID: 131EB7F7;131ED0E0
Location: Elkridge, MD

Method to check end user's subscription status?

Post by djp952 » Fri Feb 22, 2019 8:38 pm

Hi! Is there a legitimate method that can be used to check the end user's DVR subscription status using the tuner DeviceAuth string(s)?

What I would like to be able to do is to disable any DVR-specific application functionality if the user has no subscription, since it would fail anyway. If the user has a subscription that has lapsed, I would also like to be able to provide them with a notification, if that information is available.

Right now I can key off of the presence of a discoverable RECORD engine, and if that is the best/only method available I think it would work well enough. Just wondering if there is a 'better' or more appropriate way that I should be using -- the lack of a RECORD engine does not necessarily mean the user isn't a subscriber.

Thank you!

Online
signcarver
Expert
Posts: 8261
Joined: Wed Jan 24, 2007 1:04 am
Device ID: 131B34B7 13231F92 1070A18E 1073ED6F

Re: Method to check end user's subscription status?

Post by signcarver » Fri Feb 22, 2019 9:08 pm

I don't believe there is but my suggestion would be a guide request for the future (it used to only need 4 hours but now it would need at least a day)... you might also want to do that on a per DeviceAuth in case some aren't registered to the account and the DVR didn't detect th ones that are.

djp952
Posts: 898
Joined: Wed Oct 01, 2008 8:46 pm
Device ID: 131EB7F7;131ED0E0
Location: Elkridge, MD

Re: Method to check end user's subscription status?

Post by djp952 » Sat Feb 23, 2019 8:56 pm

signcarver wrote:
Fri Feb 22, 2019 9:08 pm
I don't believe there is but my suggestion would be a guide request for the future (it used to only need 4 hours but now it would need at least a day)... you might also want to do that on a per DeviceAuth in case some aren't registered to the account and the DVR didn't detect th ones that are.
Thanks! I'd been using a browser to try and verify what APIs will return 403 or not, and using that method they all seem to just return the string 'null'. However, when using raw HTTP requests I am getting the expected 403 if the deviceauth is bad.

Great tip, and greatly appreciated signcarver. I also like the idea of checking the individual DeviceAuth strings one at a time, it would be nice to alert the user if they have one or more devices that aren't registered.

edit: I think the search API may be a better choice, since if you omit search criteria you get back 'null' instead of a bunch of data to discard. You get back HTTP 403 if the authorization is no good. I'd rather not pull all kinds of data from SD that I'm not going to use -- trying to be a good citizen :)

Online
signcarver
Expert
Posts: 8261
Joined: Wed Jan 24, 2007 1:04 am
Device ID: 131B34B7 13231F92 1070A18E 1073ED6F

Re: Method to check end user's subscription status?

Post by signcarver » Sun Feb 24, 2019 5:31 pm

the thing is the tuner should have a valid DeviceAuth for 24 hours of data (used to be that first 4), even for search, that is why I would suggest to pull one request for a time a few days/week in the future... and though I think trying to pull up the rules would most likely suffice, it would not surprise me if that worked for some time while the account is between renewal so they would not

nickk
Silicondust
Posts: 15524
Joined: Tue Jan 13, 2004 9:39 am

Re: Method to check end user's subscription status?

Post by nickk » Mon Feb 25, 2019 1:11 pm

The API is:
https://api.hdhomerun.com/api/account?DeviceAuth=xxx

(The AccountState string is legacy)

Nick

Online
signcarver
Expert
Posts: 8261
Joined: Wed Jan 24, 2007 1:04 am
Device ID: 131B34B7 13231F92 1070A18E 1073ED6F

Re: Method to check end user's subscription status?

Post by signcarver » Mon Feb 25, 2019 5:50 pm

Thanks nickk... has this been around awhile or something recently added as such sounded like a good idea?

djp952
Posts: 898
Joined: Wed Oct 01, 2008 8:46 pm
Device ID: 131EB7F7;131ED0E0
Location: Elkridge, MD

Re: Method to check end user's subscription status?

Post by djp952 » Mon Feb 25, 2019 9:14 pm

nickk wrote:
Mon Feb 25, 2019 1:11 pm
The API is:
https://api.hdhomerun.com/api/account?DeviceAuth=xxx

(The AccountState string is legacy)

Nick
Thank you!!!

djp952
Posts: 898
Joined: Wed Oct 01, 2008 8:46 pm
Device ID: 131EB7F7;131ED0E0
Location: Elkridge, MD

Re: Method to check end user's subscription status?

Post by djp952 » Wed Jun 19, 2019 7:46 am

Hi again, this API appears to have changed recently ... can you assist in clarifying if we should now use the "DvrActive" field as opposed to the previous "DVR" field to determine if the user has a valid DVR subscription?

It may seem obvious, and this is what I assume, but I wanted to be sure this doesn't mean something else, like "the user's DVR device is online" and a different field(s) should be used now to check subscription status.

Thank you!

nickk
Silicondust
Posts: 15524
Joined: Tue Jan 13, 2004 9:39 am

Re: Method to check end user's subscription status?

Post by nickk » Wed Jun 19, 2019 8:33 am

Oh sorry, yes, the DVR field was renamed DvrActive to match internal naming.

Nick

djp952
Posts: 898
Joined: Wed Oct 01, 2008 8:46 pm
Device ID: 131EB7F7;131ED0E0
Location: Elkridge, MD

Re: Method to check end user's subscription status?

Post by djp952 » Wed Jun 19, 2019 4:37 pm

nickk wrote:
Wed Jun 19, 2019 8:33 am
Oh sorry, yes, the DVR field was renamed DvrActive to match internal naming.

Nick
No worries! Thank you for the quick response, sir!

Post Reply