Jump to content

PlayingItems API Problem


chessdragon136

Recommended Posts

chessdragon136

Hi All,

 

Recently I started some basic analysis of the Samsung API for creating a Smart TV App. However I have come across a problem in using the API.. 

 

I have been able to get a user authorised but I cannot get the playingitems api call to register with the server... Below are the specifics:

 

Code:

 

 

xmlHttp = new XMLHttpRequest();
        alert (url);
        
        xmlHttp.open( "POST", url , false );
        
        xmlHttp.setRequestHeader("Authorisation", "MediaBrowser");
        xmlHttp.setRequestHeader("UserId", "4b4c128121aa642086bb225659a7d471");
        xmlHttp.setRequestHeader("Client", "other");
        xmlHttp.setRequestHeader("Device", "Samsung TV");
        xmlHttp.setRequestHeader("DevideId", "0000000000001");
        xmlHttp.setRequestHeader("Version", "1.0.0.0");
        xmlHttp.setRequestHeader("Content-Type", 'application/json; charset=UTF-8'); 
 
        xmlHttp.send(null);
        alert (xmlHttp.responseText);
 
I get no responseText which I assume is ok (none seems defined in the API docs) but nothing shows up in the active connections either in the dashboard.. Have tried to look through the logs but I don't see anything - If i send the values through as a JSON in the body I get a nullreference error..
 
I assume I'm completely misunderstanding the API at this point - probably being dumb!!
 
Thanks

 

Link to comment
Share on other sites

the identification values are not separate values, they all go into authorization. use the chrome debugger in the web client to see an example.

Link to comment
Share on other sites

chessdragon136

Ok thanks - Have altered it to be:

 

 

xmlHttp = new XMLHttpRequest();

        alert (url);
        
        xmlHttp.open( "POST", url , false );
        
        xmlHttp.setRequestHeader("Authorization", "MediaBrowser Client='Android', Device='Samsung Smart TV', DeviceId='00000000000000000000000000000000', Version='1.0.0.0', UserId='4b4c128121aa642086bb225659a7d471'");
        xmlHttp.setRequestHeader("Content-Type", 'application/json; charset=UTF-8'); 
           
        xmlHttp.send(null);
        alert (xmlHttp.responseText);

 

What API requirements do I need to fulfil to get it showing in the Active Connections on the dashboard? And are there any server side tools that i can use to check the headers are sent correctly?

 

Thanks,

Link to comment
Share on other sites

you need to authenticate and that should be about it. the dashboard will show the session without an image, but that can be added later.

Link to comment
Share on other sites

chessdragon136

I was hoping you wouldn't say that.. I authenticate on the program launch and get the below in the log file

 

"2014-02-09 17:05:49.5503 Info - App: Authentication request for Steve has succeeded."

 

xmlHttp = new XMLHttpRequest();
        url = this.ServerURL + "/Users/AuthenticateByName?format=xml";
        
        xmlHttp.open( "POST", url , false );
        xmlHttp.setRequestHeader("Content-Type", 'application/xml'); 
        
        //The below needs to become dynamic at some point!
        var params = "<AuthenticateUserByName xmlns:i='http://www.w3.org/2001/XMLSchema-instance' xmlns='http://schemas.datacontract.org/2004/07/MediaBrowser.Api'><Password>REMOVED for security</Password><Username>Steve</Username></AuthenticateUserByName>";              
        
        xmlHttp.send(params);
        alert (xmlHttp.responseText);

 

Any thoughts? - Feel free to ask for logs if need

Link to comment
Share on other sites

chessdragon136

Ok it now shows in the dashboard but doesnt show the playing video - its progress :D - Thanks for your help

Edited by chessdragon136
Link to comment
Share on other sites

chessdragon136

Thanks - Will take a look, although will have to test jQuery on the TV to see if it can handle it

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...