Web Service Connection

From wiki.jriver.com
Revision as of 18:21, 25 May 2011 by Matt (talk | contribs)
Jump to navigation Jump to search

To connect to the Web Service, J. River recommends the following flow. Please note that Gizmo uses a similar approach.

Ask the user for an access key

An access key will be six case-sensitive letters. No digits or symbols are used.


Lookup server address from Access Key

Call the web service (replace [Access Key] with the actual access key):
http://webplay.jriver.com/libraryserver/lookup?id=[Access Key]

It is recommended that you use a short timeout.


Optionally wake computers

Loop the IP addresses returned and send a wake request to each MAC address returned.


Try connecting to each IP address

Loop the IP addresses returned, and attempt to connect to: http://[Returned IP Address]:[Returned Port]/MCWS/v1/Alive

Parse the response and make sure the access key matches the access key entered by the user.

Also, check the library version and program version as necessary.


Authenticate

Call the web service function: MCWS/v1/Authenticate

Provide the saved username and password if you have one.

Store the token returned and include it in all future calls.

If authentication does not succeeed, ask the user for their username and password. Then repeat.