• 1
  • 8
  • 9
  • 10(current)
  • 11
  • 12
  • 15
Working JSON RPC API Examples
Hello,


is anyone able to open a youtube video with JSON.

I passed several hours trying to get an example to work on my kodi (17.4) with no luck.

I would like to open it via plugin.video.youtube. If that could work i will try to do the same with my spotify addon!

thanks
Reply
(2017-08-29, 16:28)petou Wrote: Hello,


is anyone able to open a youtube video with JSON.

I passed several hours trying to get an example to work on my kodi (17.4) with no luck.

I would like to open it via plugin.video.youtube. If that could work i will try to do the same with my spotify addon!

thanks

Well you can do this via the urls:
https://github.com/Razzeee/plugin.video..../plugin.py

Not sure if it's also possible via json rpc
Reply
Is there a command for to play next/previous media (Next/Previous during media playback)? I could only find the play/pause command.
Reply
@MKANET

Code:
{"jsonrpc":"2.0","method":"Player.GoTo","params":{"playerid":1,"to":"next"},"id":1}
{"jsonrpc":"2.0","method":"Player.GoTo","params":{"playerid":1,"to":"previous"},"id":1}  //had to tap 2 times to get previous song

I found the answer for my previous post. To play specific youtube video via youtube plugin:

Code:
{"jsonrpc":"2.0","method":"Player.Open","params":{"item":{"file":"plugin://plugin.video.youtube/play/?video_id=wQP9XZc2Y_c"}},"id":"1"}

videoid is in the video youtube address see : This link
Reply
Thanks petou.

It looks like the method Player.GoTo is isn't recognized; at least, on my installation of Kodi 17 on Windows.

Below, is the code that worked for me:

Code:
{ "jsonrpc": "2.0", "method": "Input.ExecuteAction", "params": { "action": "skipnext" }, "id": 1 }
{ "jsonrpc": "2.0", "method": "Input.ExecuteAction", "params": { "action": "skipprevious" }, "id": 1 }


(2017-09-09, 13:06)petou Wrote: @MKANET

Code:
{"jsonrpc":"2.0","method":"Player.GoTo","params":{"playerid":1,"to":"next"},"id":1}
{"jsonrpc":"2.0","method":"Player.GoTo","params":{"playerid":1,"to":"previous"},"id":1}  //had to tap 2 times to get previous song
Reply
Weird, it's the code i used for my kodi 17.4 on ubuntu... I'll try yours tomorrow.

Glad you found it!

edit: Just tried your method and it work as well.
Reply
(2016-04-29, 19:21)atailo Wrote: friends, I am not managing to filter movies based on cast, property name. I can filter based on year but would like to filter based on the artist because the artist created filter and would like to use the name of each artist to find the films he participates.

I used this example json. can anybody help me ? (in my collection has a movie with actor this example.)

{"jsonrpc": "2.0", "method": "VideoLibrary.GetMovies", "params": { "filter": {"field": "cast", "operator": "contains", "value": "Ben Affleck"}, "limits": { "start" : 0, "end": 75 }, "properties" : ["cast"], "sort": { "order": "ascending", "method": "label", "ignorearticle": true } }, "id": "libMovies"}
This was posted on this thread a couple of years ago, but I haven't seen any replies to it.
I'm also trying to filter on cast contents, without any luck.
Has anyone got a working example of such a filter?
Thanks in advance :-}
Reply
(2018-03-26, 17:11)agb2 Wrote:
(2016-04-29, 19:21)atailo Wrote: friends, I am not managing to filter movies based on cast, property name. I can filter based on year but would like to filter based on the artist because the artist created filter and would like to use the name of each artist to find the films he participates.

I used this example json. can anybody help me ? (in my collection has a movie with actor this example.)

{"jsonrpc": "2.0", "method": "VideoLibrary.GetMovies", "params": { "filter": {"field": "cast", "operator": "contains", "value": "Ben Affleck"}, "limits": { "start" : 0, "end": 75 }, "properties" : ["cast"], "sort": { "order": "ascending", "method": "label", "ignorearticle": true } }, "id": "libMovies"}
This was posted on this thread a couple of years ago, but I haven't seen any replies to it.
I'm also trying to filter on cast contents, without any luck.
Has anyone got a working example of such a filter?
Thanks in advance :-}  
The correct field is "actor", not "cast". Try this:

json:
{"jsonrpc": "2.0", "method": "VideoLibrary.GetMovies", "params": { "filter": {"field": "actor", "operator": "contains", "value": "Ben Affleck"}, "limits": { "start" : 0, "end": 2 }, "properties" : ["cast"], "sort": { "order": "ascending", "method": "label", "ignorearticle": true } }, "id": "33"}

You can see the valid filters in the wiki (https://kodi.wiki/view/JSON-RPC_API/v8#V....GetMovies), just expand the JSON Schema Description and scroll down. According to that website the other valid filters are genreid, genre, year, director, studio, setid, tag and country. I've not tested those other filters though.
Reply
(2018-03-29, 21:37)ncarthy Wrote:
(2018-03-26, 17:11)agb2 Wrote:
(2016-04-29, 19:21)atailo Wrote: friends, I am not managing to filter movies based on cast, property name. I can filter based on year but would like to filter based on the artist because the artist created filter and would like to use the name of each artist to find the films he participates.

I used this example json. can anybody help me ? (in my collection has a movie with actor this example.)

{"jsonrpc": "2.0", "method": "VideoLibrary.GetMovies", "params": { "filter": {"field": "cast", "operator": "contains", "value": "Ben Affleck"}, "limits": { "start" : 0, "end": 75 }, "properties" : ["cast"], "sort": { "order": "ascending", "method": "label", "ignorearticle": true } }, "id": "libMovies"}
This was posted on this thread a couple of years ago, but I haven't seen any replies to it.
I'm also trying to filter on cast contents, without any luck.
Has anyone got a working example of such a filter?
Thanks in advance :-}    
The correct field is "actor", not "cast". Try this:

json:
{"jsonrpc": "2.0", "method": "VideoLibrary.GetMovies", "params": { "filter": {"field": "actor", "operator": "contains", "value": "Ben Affleck"}, "limits": { "start" : 0, "end": 2 }, "properties" : ["cast"], "sort": { "order": "ascending", "method": "label", "ignorearticle": true } }, "id": "33"}

You can see the valid filters in the wiki (https://kodi.wiki/view/JSON-RPC_API/v8#V....GetMovies), just expand the JSON Schema Description and scroll down. According to that website the other valid filters are genreid, genre, year, director, studio, setid, tag and country. I've not tested those other filters though.  
Thanks for the reply. I had managed to work this out after posting.
I am now attempting to filter on ActorA *and* ActorB.
Do you by any chance have a working example of this?
Cheers :-}
Reply
I'm hoping someone would be kind enough help get me with this.  I've tried throwing everything and the kitchen sink at this with not much luck.

I would like to execute playback of a Spotify Music addon playlist.  I am able to pull up the Music addon's root menu\directory items via curl... However, I'm not sure what to do next.  Here's the command:

json:
curl.exe -i -X POST -H "Content-Type: application/json" -d "{\"jsonrpc\": \"2.0\", \"id\": \"1\", \"method\": \"Files.GetDirectory\", \"params\": {\"directory\": \"plugin://plugin.audio.spotify/\"}}" http://localhost:8091/jsonrpc

Here's the result:

{"id":"1","jsonrpc":"2.0","result":{"files":[{"file":"plugin://plugin.audio.spotify/?action=browse_main_library","filetype":"directory","label":"My Music","type":"unknown"},{"file":"plugin://plugin.audio.spotify/?action=browse_main_explore","filetype":"directory","label":"Explore","type":"unknown"},{"file":"plugin://plugin.audio.spotify/?action=search","filetype":"directory","label":"Search","type":"unknown"},{"file":"plugin://plugin.audio.spotify/?action=browse_playback_devices","filetype":"directory","label":"Playback device: Local playback on this device","type":"unknown"},{"file":"plugin://plugin.audio.spotify/?action=switch_user","filetype":"file","label":"Current user: mkanet","type":"unknown"}],"limits":{"end":5,"start":0,"total":5}}}

So, how can I playback the Spotify playlist... "My Music\Night Rider" via command line?  Currently, I can only see the "My Music" menu item from my previous query above.

Edit:  As desperate as I am, I've been just throwing anything I can think of at the command line (hoping maybe I'll accidentally get lucky).  I've looked at the Spotify Addon via the Kodi Web Interface..  This is the best I could come up with; which, of course returns no results.

json:
curl -s --data-binary '{\"jsonrpc\":\"2.0\",\"id\":\"1\",\"method\":\"Player.Open\",\"params\":{\"item\":{\"file\":\"plugin://plugin.audio.spotify/?action=play_playlist&ownerid=spotify&playlistid=37i9dQZF1DX6GJXiuZRisr\"}}}' -H 'content-type: application/json;' http://localhost:8091/jsonrpc

Edit #2:  While waiting for someone two help out, I also tried to do this with the Google Music addon.  Same result... no errors no result:
json:
curl -s --data-binary '{\"jsonrpc\":\"2.0\",\"id\":\"1\",\"method\":\"Player.Open\",\"params\":{\"item\":{\"file\":\"plugin.audio.googlemusic.exp/?path=playlist&playlist_id=thumbsup\"}}}' -H 'content-type: application/json;' http://localhost:8091/jsonrpc
Any help would be greatly appreciated!
MKANET
Reply
can I add string in this method json-rpc:



headers = {
    'Content-Type': 'application/json',
}

data =  '{"jsonrpc":"2.0","method":"Addons.ExecuteAddon","params":{"addonid":"script.windowsid"},"id":1}'

response = requests.post('http://192.168.15.20:8080/jsonrpc', headers=headers, data=data, auth=('user', '1234'))

I am thinking to add string to travel with Addons.ExecuteAddon method.

How about this :
{ "id": "Array.String",
"type": "array",
"items": { "minLength": 1,
"type": "string" } }

How can I do this scenario?

Thanks for all
Reply
Don't know where to put this but hope somebody can help.

As of Kodi 17 I used to invoke Alexa --> IFTTT --> Kodi JSON-RPC to change PVR channels in Kodi via HTTP GET and "http://URL/jsonrpc?request={ "jsonrpc": "2.0", "method": "Player.Open", "params": { "item": { "channelid": 5} }, "id": 3 }" which worked liked a charme. I understand that the API changes in v18 don't allow for "GET" but I simply have no idea how a working example for the v18 API would look like for my case.

Thanks in advance.
Reply
(2018-09-23, 19:48)iophobia Wrote: Don't know where to put this but hope somebody can help.

As of Kodi 17 I used to invoke Alexa --> IFTTT --> Kodi JSON-RPC to change PVR channels in Kodi via HTTP GET and "http://URL/jsonrpc?request={ "jsonrpc": "2.0", "method": "Player.Open", "params": { "item": { "channelid": 5} }, "id": 3 }" which worked liked a charme. I understand that the API changes in v18 don't allow for "GET" but I simply have no idea how a working example for the v18 API would look like for my case.

Thanks in advance.
I also use something very similar...  Cortana ---> IFTTT ---> Kodi JSON-RPC.  I'm still using Kodi 17.  I would like to know too before upgrading to Kodi 18.
Reply
hello everyone,

I am trying to use the app Anymote to control my Kodi and my tv.
The app supports network commands but I can't make it work. anyone had any luck with this?

I have working HTTP POST command that I simply paste into web browser and kodi either start playing or pausing current media.
How do I transfer this line of code into AnyMote Network Command that look like in this 

Image


Thanks in advance
Reply
(2018-09-23, 19:48)iophobia Wrote: Don't know where to put this but hope somebody can help.

As of Kodi 17 I used to invoke Alexa --> IFTTT --> Kodi JSON-RPC to change PVR channels in Kodi via HTTP GET and "http://URL/jsonrpc?request={ "jsonrpc": "2.0", "method": "Player.Open", "params": { "item": { "channelid": 5} }, "id": 3 }" which worked liked a charme. I understand that the API changes in v18 don't allow for "GET" but I simply have no idea how a working example for the v18 API would look like for my case.

Thanks in advance.
 Get is supported in V18 according to the protocol table here.
Learning Linux the hard way !!
Reply
  • 1
  • 8
  • 9
  • 10(current)
  • 11
  • 12
  • 15

Logout Mark Read Team Forum Stats Members Help
Working JSON RPC API Examples0