Trying out the json rpc with tasker
#1
Hi there. I've been trying to control XBMC through tasker using the JSON-RPC, but haven't had a working project so far. Perhaps someone can help me to understand the subject matter?

I've set up a 'http get'-task with the attribute as per the wiki, but it doesn't trigger anything

Code:
http://xbmc:[email protected]:8090/jsonrpc?request={"jsonrpc":"2.0","method":"VideoLibrary.Scan"}

Tried the url from IE. Doesn't work either. However, the url that does trigger a library update is:

Code:
http://192.168.1.40:8090/jsonrpc?request={"jsonrpc":"2.0","method":"VideoLibrary.Scan"}[/code

However, this does lead to IE asking me for the username and password (I was under the impression that http-requests don't require them).

So basically I'm stumped as to:

a) How to deal with the username and password
b) How to get it into tasker

Perhaps someone can lend me their expertise?
Reply
#2
i can't really comment because I don't use json, but I notice that your two IP's are different in the above. is that intentional or is one of them mistyped?
Reply
#3
It's a typo I made on the forum, set it up in tasker with the right IP. Thanks for pointing this out. I'll edit my message.
Reply
#4
This may be better posted in the JSON RPC subforum, but here are my thoughts:

According to the wiki (http://wiki.xbmc.org/?title=JSON-RPC_API#HTTP) if you use a GET request then the data needs to be url encoded (not sure how you do that from Tasker). You could do a POST request but you'd need to make sure you set the content-type to "application/json" (and this is possible in Tasker).
BBC Live Football Scores: Football scores notifications service.
script.squeezeinfo: shows what's playing on your Logitech Media Server
Reply
#5
Confirmed. Using POST I can send requests from Tasker. It does seem that I still need to use username:password@ipaddress format for this to work.
BBC Live Football Scores: Football scores notifications service.
script.squeezeinfo: shows what's playing on your Logitech Media Server
Reply
#6
Hey that's nice. Thanks for the reply.

Didn't know about the JSON-subforum btw, but after this thread I'll post my JSON-related questions there. And I'll give myself a good read there anyways. :-)

Would the below be right for tasker, or did you do the url elsewhere?

Type: http post
Server:port: 192.168.1.40:8090
Path: http://username:password/192.168.1.40:8090/jsonrpc?request={"jsonrpc":"2.0","method":"VideoLibrary.Scan"}
Content type: application/json
Reply
#7
Tasker = Win!

Would be eager to see your end project!
Im currently trying to control my boblight setup from it.
Reply
#8
(2014-09-19, 09:03)Ferdi-T Wrote: Hey that's nice. Thanks for the reply.

Didn't know about the JSON-subforum btw, but after this thread I'll post my JSON-related questions there. And I'll give myself a good read there anyways. :-)

Would the below be right for tasker, or did you do the url elsewhere?

Type: http post
Server:port: 192.168.1.40:8090
Path: http://username:password:192.168.1.40:80...pc?request={"jsonrpc":"2.0","method":"VideoLibrary.Scan"}
Content type: application/json

I'd do it like this...

Create a task that sends the request:
Code:
Type: http post
Server:port: http://username:[email protected]:8090
Path: jsonrpc
Data/File: Use a variable e.g. %xbmcjson
Content Type: application/json
Then all you have to do for new commands is set the xbmcjson variable with the right request and run the above task.
BBC Live Football Scores: Football scores notifications service.
script.squeezeinfo: shows what's playing on your Logitech Media Server
Reply
#9
Thanks to your help I was finally able to get it working (I didn't even need to use vars, setting datas/file with the request did the trick). Muchos gracias!
Reply
#10
De nada!
BBC Live Football Scores: Football scores notifications service.
script.squeezeinfo: shows what's playing on your Logitech Media Server
Reply

Logout Mark Read Team Forum Stats Members Help
Trying out the json rpc with tasker0