FAQ  •  Register  •  Login

Web "API" to check for new versions (etc.)

<<

ptyork

User avatar

Serviio newbie

Posts: 18

Joined: Wed May 11, 2011 7:36 pm

Location: Augusta, GA, USA

Post Sat Dec 31, 2011 10:41 pm

Web "API" to check for new versions (etc.)

Hi Zip,

I'm about ready to release add-ins for both WHS and WHS 2011 (really just waiting on the GA release of 0.6.1 and an install script for 2011). However, I was wondering if you would think about adding a feature to your web site. I'd like to be able to notify users of updates to both Serviio and the add-ins. I can probably kludge a way to do it with CodePlex and my add-in. However, I don't know of a way to do this with Serviio itself.

Ideally, I'd like to be able to make an HTTP request with a parameter specifying the API version and have it return back the latest "compatible" version of Serviio. So, say I request "http://www.serviio.org/upgradeCheck.php?current-version=0.6.1", you would return a JSON object with the latest version number that will still work (i.e., doesn't break, though may lack new functionality) against that API version and a URL to the download. You might also have a latestVersion.php script that doesn't require a parameter that simply returns a JSON object with the latest version number and the URL.

As an aside, I've been stung a number of times with errors related to passing 0.6.1 XML elements in my REST calls to a 0.6.0 server (I'm attempting to support this use case for those not wishing to upgrade their server version when they install the new add-in). It bombs out with an HTTP 500 error. This is quite odd, IMO. I'd think you'd just ignore the extra elements. It's not a huge deal as I've put in some conditional logic to exclude these extra elements if the server version isn't at least 0.6.1, but it definitely handles things less "gracefully" than I'd expect.

Thanks,
Paul
<<

will

DLNA master

Posts: 2122

Joined: Mon Aug 30, 2010 11:18 am

Location: UK

Post Sat Dec 31, 2011 11:29 pm

Re: Web "API" to check for new versions (etc.)

I've been using json rather than xml for my android console and so far it has worked well across different versions. I believe zip uses gson to parse the json which will happily ignore extra fields. On the other end, if you expect a field that the server doesn't send, it is set to null. I've had to do a few checks against the version number for some things, but it hasn't been too bad. Obviously there would be quite a few changes required to move to json, so hopefully zip can make the xml parser more tolerant.

As for being able to get the latest version (without parsing the news feed :-) ), that could be useful. Either through the website or via the REST API direct from the server.

As for checking against breaking api changes, it might be helpful to include the rest api version in the application call.
Will
Beta Tester Group
ServiiDroid (Android Console) Developer: Download | Home | Support
ServiiGo (Android 3G/4G/WiFi Playback App) Developer: More info

Player: Sony BDP S370 | Server: Debian 6.0 x86
HowTo: Provide supported formats of a device HowTo: Record a new ticket on Bitbucket
HowTo: Provide details of a video file that doesn't play
<<

ptyork

User avatar

Serviio newbie

Posts: 18

Joined: Wed May 11, 2011 7:36 pm

Location: Augusta, GA, USA

Post Sun Jan 01, 2012 12:30 am

Re: Web "API" to check for new versions (etc.)

I think the option of checking "locally" via the REST API is a good one, so long as it is also possible to check directly using a web URL. My add-in needs to use it before installing Serviio (to actually download and install it for the user), so it'd be a bit chicken and egg. :) Thanks for the info regarding JSON. I'd initially planned to "upgrade" to the JSON version of the API with this release since it's SOOOOO much easier to use a dynamic JSON parser than to manually parse everything using XPath, but, well, if it ain't broke...
<<

zip

User avatar

Serviio developer / Site Admin

Posts: 16790

Joined: Sat Oct 24, 2009 12:24 pm

Location: London, UK

Post Sun Jan 01, 2012 3:04 pm

Re: Web "API" to check for new versions (etc.)

Noyt sure if that helps, but currently you can do

  Code:
http://localhost:23423/rest/application


which returns

  Code:
<application>
   <version>0.5</version>
   <updateVersionAvailable>0.5.1</updateVersionAvailable>
</application>


updateVersionAvailable is only there if the current version is old to notify user that there is a new version available for download. It goes to this URL to fetch the data

  Code:
http://update.serviio.org/releases.xml
<<

will

DLNA master

Posts: 2122

Joined: Mon Aug 30, 2010 11:18 am

Location: UK

Post Sun Jan 01, 2012 4:52 pm

Re: Web "API" to check for new versions (etc.)

That would help, could you note that in the API docs as it is not there.

If application could be extended to something like the following so that API version can be used for checking and to also include the oldest API version that will still work. This will mean apps can connect without having to know about the future versions/having defensive !=null checks everywhere.

  Code:
<application>
   <version>0.7</version>
   <apiVersion>1.5</apiVersion>
   <compatiableApiVersion>1.3</compatiableApiVersion>   
   <updateVersionAvailable>0.8</updateVersionAvailable>
</application>


A futher extentions would be to also include information about compatability of any update that is available.
It will allow the apps to know if an available update will break them.

  Code:
<application>
   <version>0.7</version>
   <apiVersion>1.5</apiVersion>
   <compatiableApiVersion>1.3</compatiableApiVersion>   
   <updateVersionAvailable>0.8</updateVersionAvailable>
   <updateVersionInfo>         
         <version>0.8</version>
         <apiVersion>1.6</apiVersion>
         <compatiableApiVersion>1.6</compatiableApiVersion>
   </updateVersionInfo>
</application>
Will
Beta Tester Group
ServiiDroid (Android Console) Developer: Download | Home | Support
ServiiGo (Android 3G/4G/WiFi Playback App) Developer: More info

Player: Sony BDP S370 | Server: Debian 6.0 x86
HowTo: Provide supported formats of a device HowTo: Record a new ticket on Bitbucket
HowTo: Provide details of a video file that doesn't play
<<

ptyork

User avatar

Serviio newbie

Posts: 18

Joined: Wed May 11, 2011 7:36 pm

Location: Augusta, GA, USA

Post Sun Jan 01, 2012 5:06 pm

Re: Web "API" to check for new versions (etc.)

I could probably squeak by with the existing releases.xml query, except I'd need the download URL added as an attribute to each release node. I like will's idea even better, though again a) I'd want this to be available without having the server already installed and b) I need the URL. "Need" here of course is "would like," as this is all just gravy. :)
<<

zip

User avatar

Serviio developer / Site Admin

Posts: 16790

Joined: Sat Oct 24, 2009 12:24 pm

Location: London, UK

Post Sun Jan 01, 2012 5:53 pm

Re: Web "API" to check for new versions (etc.)

That's a bit too much for me to keep track of ;-) I'm always developing to the latest API and only the latest server version is supported here on the forums.

Also Serviio is still not a 1.0 yet so the API is bound to change a bit. For now you should assume if there is a new version available it has some changes in the API.
<<

will

DLNA master

Posts: 2122

Joined: Mon Aug 30, 2010 11:18 am

Location: UK

Post Sun Jan 01, 2012 6:13 pm

Re: Web "API" to check for new versions (etc.)

No thats fine (was getting a bit carried away anyway).

New additions are fine, its removing things that is a pain.
Will
Beta Tester Group
ServiiDroid (Android Console) Developer: Download | Home | Support
ServiiGo (Android 3G/4G/WiFi Playback App) Developer: More info

Player: Sony BDP S370 | Server: Debian 6.0 x86
HowTo: Provide supported formats of a device HowTo: Record a new ticket on Bitbucket
HowTo: Provide details of a video file that doesn't play
<<

ptyork

User avatar

Serviio newbie

Posts: 18

Joined: Wed May 11, 2011 7:36 pm

Location: Augusta, GA, USA

Post Sun Jan 01, 2012 7:33 pm

Re: Web "API" to check for new versions (etc.)

Ja, that's understood. I can keep track of whether a new version is or is not supported by my add-in, I guess. But could you just add the download url to your releases.xml file so that the download could be automated? I.e.:

<serviio_releases>
<release os="windows" version="0.6.0.1" url="http://download.serviio.org/releases/serviio-0.6.0.1-win-setup.exe" />
<release os="linux" version="0.6.0.1" url="http://download.serviio.org/releases/serviio-0.6.0.1-linux.tar.gz"/>
<release os="osx" version="0.6.0.1" url="http://download.serviio.org/releases/serviio-0.6.0.1-osx.tar.gz"/>
</serviio_releases>

If not, I suppose I can do all of this on my end (i.e., keep track of new releases and where to get them). But it'd be nice to offer this to everyone.
<<

zip

User avatar

Serviio developer / Site Admin

Posts: 16790

Joined: Sat Oct 24, 2009 12:24 pm

Location: London, UK

Post Sun Jan 01, 2012 11:39 pm

Re: Web "API" to check for new versions (etc.)

Why the download URL? I'm having issues with bandwidth, especially after a new release - too many ppl download and at some point it might stop working because the provider cuts me off. I have a mirror as well now, but the XML wouldn't include that. I think it's best to point people to the website - where they can click on a banner ;-) - and possibly in future pick an edition they want to download.
<<

ptyork

User avatar

Serviio newbie

Posts: 18

Joined: Wed May 11, 2011 7:36 pm

Location: Augusta, GA, USA

Post Mon Jan 02, 2012 3:15 am

Re: Web "API" to check for new versions (etc.)

Yeah, perhaps mine is a special case, though. As you well know, WHS is a bit of an odd environment. The whole point of it is to make brain-dead simple server apps. The management console itself is really a mini-RDP session running on the remote server. So while they could click on a link and download something in their local browser, installing it on the WHS box is a "power-user" exercise requiring a copy to a shared folder and a trip into the world of remote desktop. I'm trying to make is so that users don't have to do anything outside of the management console. As such, when the add-in is installed, it checks to see if Serviio is already installed. If not, it provides a button to allow them to download and initiate the Serviio install (which itself is a bit wonky since I have to kick it off and force it to become a child window less it end up lost "behind" the management console). Anyway, I think it makes for a pretty "integrated" experience for those who aren't all that adept at server management.

Note that I've done it this way because I figured you'd want it done that way (i.e., they download Serviio only from you so you can track the number of downloads). However, I could just as easily include the install binary in my add-in install package. If that's your preference, I can make it happen pretty easily.
<<

zip

User avatar

Serviio developer / Site Admin

Posts: 16790

Joined: Sat Oct 24, 2009 12:24 pm

Location: London, UK

Post Mon Jan 02, 2012 1:28 pm

Re: Web "API" to check for new versions (etc.)

Did you check how the others are doing this? I think there is PS3MS plugin for example.

Obviously ideal would be some kind of gateway on my server that would route the requests to mirrors as necessary, but that is far in the future I think ;-)

Return to Third-party tools integration

Who is online

Users browsing this forum: No registered users and 1 guest

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.