Working JSON RPC API Examples
#93
(2016-09-19, 20:10)black_eagle Wrote: Get the available PVR channel groups

PHP Code:
result=$( curl ---data-binary '{"jsonrpc": "2.0", "method": "PVR.GetChannelGroups", "params": {"channeltype" : "tv"}, "id": 1 }' -'content-type: application/json;' http://$xbmcAddress:$xbmcPort/jsonrpc) 

Use jq to get the channel group ID for 'All channels'. Note, you can change this for whatever channels tags you have set up.

PHP Code:
groupid=$(echo $result jq '.result.channelgroups[] | select(.label=="All channels") | .channelgroupid'

Get channel names and numbers for all channels in the group.

PHP Code:
result=$( curl ---data-binary '{"jsonrpc": "2.0", "method": "PVR.GetChannels", "params": {"channelgroupid" : '$groupid',"properties":["channel"]}, "id": 1 }' -'content-type: application/json;' http://$xbmcAddress:$xbmcPort/jsonrpc) 

Start channel '$startchan' playing

PHP Code:
result=$( curl ---data-binary '{"jsonrpc": "2.0", "method": "Player.Open","params":{"item":{"channelid": '"$startchan"'}}, "id": 1}' -'content-type: application/json;' http://$xbmcAddress:$xbmcPort/jsonrpc) 

Thanks Black Eagle

I'm new to Linux and Kodi and I am having trouble getting these to work! Here is how I have tested the commands I posted above. One was I used Chrome using the "Simple REST Client" option, and was able to get the strings I posted to show a result in a working Kodi machine that was set static and to port 8080. "I sent these in the form in which you see them posted" and got a result.

I have also used a program like Putty, called "Hercules" to send just the IP strings portion of the commands I'm testing to a Kodi test machine on a static IP and to port 9090 which from what I have read is an open TCP socket, and this has been one of the easiest options, I can open a TCP socket of an IP on a port of my choosing and hold it open while I send IP test strings without the http://IPaddress/port/ in front. Example:
PHP Code:
/jsonrpc?request={"jsonrpc":"2.0","method":"AudioLibrary.GetAlbums","params":{"properties":["playcount","artist","genre"],"limits":{"end":10,"start":0},"sort":{"order":"ascending","method":"album","ignorearticle":true}},"id":"libAlbums"} -- get Albums 
and got a result on the Kodi machine.

So with that said I tried to test the portions that I'm seeing as the TCP command only, so no "http://ipaddress/port" Example, I cut and pasted this:
PHP Code:
result=$( curl ---data-binary '{"jsonrpc": "2.0", "method": "PVR.GetChannels", "params": {"channelgroupid" : '$groupid',"properties":["channel"]}, "id": 1 }' -'content-type: application/json;' 
and sent it to a Kodi machine via Hercules and Chrome with the http://IPaddress/port/jsonrp/ in front, but got no results.

As stated I'm new to Linux and Kodi and hope you can help walk me through these. I tend to poke and prod until I get things to work if you follow me! Thanks!
Reply


Messages In This Thread
Working JSON RPC API Examples - by Pghpunkid - 2013-03-01, 21:23
RE: Working JSON RPC API Examples - by ndxtg - 2013-03-16, 01:00
RE: Working JSON RPC API Examples - by darwin - 2013-05-25, 03:51
RE: Working JSON RPC API Examples - by Tolriq - 2013-04-29, 20:19
RE: Working JSON RPC API Examples - by jonib - 2013-05-27, 14:33
RE: Working JSON RPC API Examples - by roscoe - 2013-07-02, 13:07
RE: Working JSON RPC API Examples - by yallah - 2013-10-31, 14:51
RE: Working JSON RPC API Examples - by yallah - 2013-10-31, 17:42
RE: Working JSON RPC API Examples - by yallah - 2013-11-01, 00:06
RE: Working JSON RPC API Examples - by yallah - 2013-11-01, 00:28
RE: Working JSON RPC API Examples - by yallah - 2013-11-01, 00:38
RE: Working JSON RPC API Examples - by pedz - 2014-09-14, 20:37
RE: Working JSON RPC API Examples - by gb160 - 2015-02-18, 15:07
RE: Working JSON RPC API Examples - by healie - 2014-12-22, 21:31
RE: Working JSON RPC API Examples - by tdhz77 - 2015-05-16, 03:40
RE: Working JSON RPC API Examples - by axa88 - 2015-06-04, 03:56
RE: Working JSON RPC API Examples - by axa88 - 2015-07-16, 03:18
RE: Working JSON RPC API Examples - by axa88 - 2015-07-27, 03:13
RE: Working JSON RPC API Examples - by axa88 - 2015-07-27, 09:59
RE: Working JSON RPC API Examples - by axa88 - 2015-09-07, 07:41
RE: Working JSON RPC API Examples - by axa88 - 2015-10-16, 20:56
RE: Working JSON RPC API Examples - by LeeJS - 2015-10-09, 23:48
RE: Working JSON RPC API Examples - by wollk - 2015-10-23, 22:19
RE: Working JSON RPC API Examples - by atailo - 2015-11-02, 04:42
RE: Working JSON RPC API Examples - by Razze - 2015-11-02, 16:00
RE: Working JSON RPC API Examples - by atailo - 2015-11-02, 18:55
RE: Working JSON RPC API Examples - by atailo - 2015-11-03, 23:59
RE: Working JSON RPC API Examples - by Ouchie - 2016-03-05, 21:25
RE: Working JSON RPC API Examples - by _BJ1 - 2015-11-29, 20:55
RE: Working JSON RPC API Examples - by Razze - 2015-11-29, 23:32
RE: Working JSON RPC API Examples - by _BJ1 - 2015-11-30, 21:07
RE: Working JSON RPC API Examples - by Tolriq - 2015-11-30, 21:31
RE: Working JSON RPC API Examples - by Tolriq - 2016-01-27, 21:17
RE: Working JSON RPC API Examples - by atailo - 2016-02-23, 15:10
RE: Working JSON RPC API Examples - by B3rt - 2016-03-07, 04:28
RE: Working JSON RPC API Examples - by Razze - 2016-03-07, 14:48
RE: Working JSON RPC API Examples - by B3rt - 2016-03-07, 14:54
RE: Working JSON RPC API Examples - by curti - 2016-03-07, 23:21
RE: Working JSON RPC API Examples - by juju37 - 2016-03-18, 11:34
RE: Working JSON RPC API Examples - by Tolriq - 2016-03-18, 11:48
RE: Working JSON RPC API Examples - by juju37 - 2016-03-18, 12:22
RE: Working JSON RPC API Examples - by atailo - 2016-04-29, 19:21
RE: Working JSON RPC API Examples - by agb2 - 2018-03-26, 17:11
RE: Working JSON RPC API Examples - by agb2 - 2018-04-04, 11:37
RE: Working JSON RPC API Examples - by rmg9 - 2016-06-27, 14:48
RE: Working JSON RPC API Examples - by SDG72 - 2016-09-19, 19:48
RE: Working JSON RPC API Examples - by SDG72 - 2016-09-25, 03:05
RE: Working JSON RPC API Examples - by jonib - 2017-01-02, 01:14
RE: Working JSON RPC API Examples - by jonib - 2017-01-02, 04:35
RE: Working JSON RPC API Examples - by jez500 - 2017-01-20, 09:46
RE: Working JSON RPC API Examples - by B3rt - 2017-01-29, 23:06
RE: Working JSON RPC API Examples - by Wimpie - 2017-01-30, 03:03
RE: Working JSON RPC API Examples - by B3rt - 2017-01-30, 11:22
RE: Working JSON RPC API Examples - by ronie - 2017-01-30, 03:19
RE: Working JSON RPC API Examples - by ronie - 2017-01-30, 11:34
RE: Working JSON RPC API Examples - by B3rt - 2017-01-30, 11:48
RE: Working JSON RPC API Examples - by B3rt - 2017-01-30, 15:54
RE: Working JSON RPC API Examples - by isdito - 2017-03-10, 02:00
RE: Working JSON RPC API Examples - by ednt - 2017-05-22, 10:50
RE: Working JSON RPC API Examples - by ednt - 2017-05-22, 11:33
RE: Working JSON RPC API Examples - by ednt - 2017-05-22, 16:52
RE: Working JSON RPC API Examples - by petou - 2017-08-29, 16:23
RE: Working JSON RPC API Examples - by petou - 2017-08-29, 16:28
RE: Working JSON RPC API Examples - by Razze - 2017-08-29, 18:51
RE: Working JSON RPC API Examples - by MKANET - 2017-09-09, 10:11
RE: Working JSON RPC API Examples - by petou - 2017-09-09, 13:06
RE: Working JSON RPC API Examples - by MKANET - 2017-09-10, 02:23
RE: Working JSON RPC API Examples - by petou - 2017-09-10, 03:06
RE: Working JSON RPC API Examples - by MKANET - 2018-07-03, 18:58
RE: Working JSON RPC API Examples - by MKANET - 2018-09-23, 21:23
RE: Working JSON RPC API Examples - by MKANET - 2019-12-18, 18:06
RE: Working JSON RPC API Examples - by nissse - 2018-11-23, 17:21
RE: Working JSON RPC API Examples - by HTGeek - 2019-04-06, 00:48
RE: Working JSON RPC API Examples - by lysyi - 2019-08-13, 06:36
RE: Working JSON RPC API Examples - by HTGeek - 2019-08-13, 21:31
RE: Working JSON RPC API Examples - by lysyi - 2019-08-13, 22:00
RE: Working JSON RPC API Examples - by HTGeek - 2019-08-13, 22:39
RE: Working JSON RPC API Examples - by IT007 - 2019-11-15, 17:02
RE: Working JSON RPC API Examples - by MKANET - 2019-11-16, 00:52
RE: Working JSON RPC API Examples - by IT007 - 2019-11-16, 08:00
RE: Working JSON RPC API Examples - by MKANET - 2019-11-17, 03:15
RE: Working JSON RPC API Examples - by madkat - 2020-05-22, 05:20
RE: Working JSON RPC API Examples - by madkat - 2020-05-22, 05:25
RE: Working JSON RPC API Examples - by madkat - 2020-05-22, 14:24
RE: Working JSON RPC API Examples - by madkat - 2020-05-22, 21:42
RE: Working JSON RPC API Examples - by HTGeek - 2020-07-25, 18:06
RE: Working JSON RPC API Examples - by mpg732 - 2020-08-02, 06:33
RE: Working JSON RPC API Examples - by Klojum - 2020-09-22, 18:45
RE: Working JSON RPC API Examples - by _BJ1 - 2020-10-15, 09:51
RE: Working JSON RPC API Examples - by HTGeek - 2020-10-15, 21:21
RE: Working JSON RPC API Examples - by _BJ1 - 2020-10-15, 22:18
RE: Working JSON RPC API Examples - by konrul - 2021-11-11, 22:18
RE: Working JSON RPC API Examples - by konrul - 2021-11-11, 22:22
RE: Working JSON RPC API Examples - by HTGeek - 2021-11-12, 01:01
RE: Working JSON RPC API Examples - by konrul - 2021-11-12, 15:45
RE: Working JSON RPC API Examples - by Klojum - 2021-11-11, 22:28
RE: Working JSON RPC API Examples - by DaVu - 2022-02-08, 23:13
RE: Working JSON RPC API Examples - by HTGeek - 2022-10-12, 00:53
RE: Working JSON RPC API Examples - by HTGeek - 2022-10-12, 01:25
RE: Working JSON RPC API Examples - by HTGeek - 2022-10-16, 18:22
RE: Working JSON RPC API Examples - by houser - 2024-02-14, 12:11
Logout Mark Read Team Forum Stats Members Help
Working JSON RPC API Examples0