{"error":{"code":-32099,"message":"Bad client permission."},"id":1,"jsonrpc":"2.0"}
#1
hi 
i have problem . some codes is ok but some have this error.
for example: (ok)
Code:
{"jsonrpc": "2.0", "method": "Player.GetItem", "params": { "properties": ["title", "album", "artist", "duration", "thumbnail", "file", "fanart", "streamdetails"], "playerid": 0 }, "id": "AudioGetItem"}
result
Code:
{"id":"AudioGetItem","jsonrpc":"2.0","result":{"item":{"fanart":"","file":"","label":"","thumbnail":"","title":"","type":"unknown"}}}

(failed)
Code:
{"jsonrpc": "2.0", "method": "Player.PlayPause", "params": { "playerid": 0 }, "id": 1}
result
Code:
{"error":{"code":-32099,"message":"Bad client permission."},"id":1,"jsonrpc":"2.0"}

please help me .thank you
Reply
#2
could you please post the full command you are using.

I tried with:

curl -X POST -H 'Content-Type: application/json' -i http://192.168.1.162:8080/jsonrpc --data '{"jsonrpc": "2.0", "method": "Player.PlayPause", "params": { "playerid": 0 }, "id": 1}'

and that works like a charm.

ofc the IP needs to be changed to match your IP
Reply
#3
Bad client permission could mean that you need to use a password. So we might need to know which command you are using.
Reply
#4
(2020-03-30, 19:09)DaVu Wrote: Bad client permission could mean that you need to use a password. So we might need to know which command you are using.

thank you dear for help me . 
i use a  first of all commands.for example:
Code:
http://192.168.1.199:80/jsonrpc?request={"jsonrpc": "2.0", "method": "Player.PlayPause", "params": { "playerid": 0 }, "id": 1}

now i use your command and result:
Code:
http://192.168.1.199:80/jsonrpc --data '{"jsonrpc": "2.0", "method": "Player.PlayPause", "params": { "playerid": 0 }, "id": 1}'
Code:
File not found

also i have not any password in my kodi . now what am i do ? Sad
Reply
#5
I just played around with that yesterday and I have to say, that it doesn't work in the way you are trying it Wink

Please read this for reference: https://forum.kodi.tv/showthread.php?tid...light=json

A little bit of explanation...what you are doing with the method Player.GetItem is a "request". So you will "receive" some info which is then called a "GET"-request. Those "GET"-requests will work via HTTP (i. e. done in your browser). 

With the method Player.PlayPause you do not "get" an info. You would like to "send" a command to Kodi and Kodi should do something with that command. Same for Input.Up which will perform one step up at the GUI. So what you are trying to do with those methods is called a "POST" request. Those will not work anymore via HTTP, but will work perfectly via CURL (as I mentioned above) or via Python (while writing some add-on for example). 

As mentioned in the thread, this has been changed in Leia and you have to send Post requests instead. It's still able to send GET requests via http, but it will not work with any method with which you want to "modify" Kodi (be it, pausing the player, navigating the GUI or set a setting).
Reply
#6
Heart 
(2020-03-31, 06:06)DaVu Wrote: I just played around with that yesterday and I have to say, that it doesn't work in the way you are trying it Wink

Please read this for reference: https://forum.kodi.tv/showthread.php?tid...light=json

A little bit of explanation...what you are doing with the method Player.GetItem is a "request". So you will "receive" some info which is then called a "GET"-request. Those "GET"-requests will work via HTTP (i. e. done in your browser). 

With the method Player.PlayPause you do not "get" an info. You would like to "send" a command to Kodi and Kodi should do something with that command. Same for Input.Up which will perform one step up at the GUI. So what you are trying to do with those methods is called a "POST" request. Those will not work anymore via HTTP, but will work perfectly via CURL (as I mentioned above) or via Python (while writing some add-on for example). 

As mentioned in the thread, this has been changed in Leia and you have to send Post requests instead. It's still able to send GET requests via http, but it will not work with any method with which you want to "modify" Kodi (be it, pausing the player, navigating the GUI or set a setting).
thank you for explanation dear.
so this is very hard and complicated for me....
i am use domoticz for home automation and my kodi dont have a manitor.i want just send commands for select flash and folders(before 3 cammands needed:clear play list - select flash and folder - start play) and control some key (play/pause - stop - next - prev - repeat all - volume level)
can you build this codes (how send this command with domoticz to kodi ) please help. thank you

also if you can not help about this , so please tell me a good version of osmc that work with http commands , also work well with upnp connection(last versions have not a stable upnp connection and have many connect/disconnect) . now i have lastest version of osmc... which version work with http commands?thank you
Reply
#7
You might find this helps you get started: https://www.domoticz.com/wiki/Kodi (it gives an example of making a POST request via the curl command from domoticz).
Reply
#8
(2020-03-31, 11:43)feredy2011 Wrote: so please tell me a good version of osmc that work with http commands

None of the Kodi versions (may it be LibreELEC, OSMC or whatever) will work with HTTP commands to modify Kodi. This was implemented nearly 3 years ago: https://github.com/xbmc/xbmc/pull/12281
Reply
#9
thank you friends .
Reply
#10
(2020-03-31, 15:21)Fergus Wrote: You might find this helps you get started: https://www.domoticz.com/wiki/Kodi (it gives an example of making a POST request via the curl command from domoticz).
i found .thank you
Reply
#11
(2020-03-30, 19:06)DaVu Wrote: could you please post the full command you are using.

I tried with:

curl -X POST -H 'Content-Type: application/json' -i http://192.168.1.162:8080/jsonrpc --data '{"jsonrpc": "2.0", "method": "Player.PlayPause", "params": { "playerid": 0 }, "id": 1}'

and that works like a charm.

ofc the IP needs to be changed to match your IP
hiiiiiiiiiii dear friends. i try and this is work for me.this code in bash
curl -X POST -H 'Content-Type: application/json' -i http://192.168.1.162:8080/jsonrpc --data '{"jsonrpc": "2.0", "method": "Player.PlayPause", "params": { "playerid": 0 }, "id": 1}'

thank youuuuuuuuuuuuu. just one question. i want a command for play music from flash memory and folder.please give me a command for play music from flash memory.
also where are other codes (next - prev - volume - repeat .... )?
thanks
Reply
#12
Here’s some light reading - not sure if you’re already aware of it or not Wink

https://kodi.wiki/view/JSON-RPC_API/v8

Hopefully you can find the right combination of Methods and Parameters in there.
Reply
#13
(2020-04-01, 19:25)Fergus Wrote: Here’s some light reading - not sure if you’re already aware of it or not Wink

https://kodi.wiki/view/JSON-RPC_API/v8

Hopefully you can find the right combination of Methods and Parameters in there.

i seen this before but i could not understand. because i am beginner and weak in english.
for example i see goto command for next button :
Code:
{ "description": "Go to previous/next/specific item in the playlist", "permission": "ControlPlayback", "type": "method", "params": [ { "$ref": "Player.Id", "name": "playerid", "required": true }, { "type": [ { "enums": [ "previous", "next" ], "type": "string" }, { "$ref": "Playlist.Position", "description": "position in playlist" } ], "name": "to", "required": true } ], "returns": { "type": "string" } }
now how change this code to this format for save to a ".sh" file and send!?
Code:
curl -X POST -H 'Content-Type: application/json' -i http://192.168.1.162:8080/jsonrpc --data '{"jsonrpc": "2.0", "method": "Player.PlayPause", "params": { "playerid": 0 }, "id": 1}'
this code worked for play/pause for me.
if i can not learn how change codes... (for beginner and weak in english) so can you build this code for me ? i need jast some code (play music from flash memory (select folders) - next - prev - vol- - vol+ - repeat one and all ond off."play/pause and stop" i found these. please build other codes for me. thank you dear
Reply
#14
@Fergus Please don't point to an outdated wiki page anymore. The same schema is mentioned here: https://github.com/xbmc/xbmc/blob/master...thods.json 
and that's what is actually maintained. The wiki page may contain methods which are not available anymore or had a fundamental change. So this shouldn't be used. 
 
(2020-04-01, 14:11)feredy2011 Wrote: please give me a command for play music from flash memory.
Might be a bit difficult, as you need to change the path for yourself, but let's try something: 

Code:
curl -s -X POST http://127.0.0.1:8080/jsonrpc -H 'Content-Type: application/json' --data '{"jsonrpc": "2.0", "method": "Player.Open", "params": { "item": { "file": "/path/to/file/test.mp4" } }, "id":1 }'

So you just have to change the path to your file and where it is placed. 
 
(2020-04-01, 21:29)feredy2011 Wrote: next - prev - vol- - vol+ - repeat one and all ond off.
You can use the "Input.ExecuteAction" method for that:
Code:
curl -s -X POST http://127.0.0.1:8080/jsonrpc -H 'Content-Type: application/json' --data '{"jsonrpc": "2.0", "method": "Input.ExecuteAction","params":{"action":"up"},"id":1}'

Just replace the "up" action with what you need and what is mentioned here: https://github.com/xbmc/xbmc/blob/master...p#L25-L247

Or maybe better to read but also probably outdated: https://kodi.wiki/view/Action_IDs
Reply
#15
(2020-04-02, 08:07)DaVu Wrote: @Fergus Please don't point to an outdated wiki page anymore. The same schema is mentioned here: https://github.com/xbmc/xbmc/blob/master...thods.json 
and that's what is actually maintained. The wiki page may contain methods which are not available anymore or had a fundamental change. So this shouldn't be used. 
 
(2020-04-01, 14:11)feredy2011 Wrote: please give me a command for play music from flash memory.
Might be a bit difficult, as you need to change the path for yourself, but let's try something: 
Code:
curl -s -X POST http://127.0.0.1:8080/jsonrpc -H 'Content-Type: application/json' --data '{"jsonrpc": "2.0", "method": "Player.Open", "params": { "item": { "file": "/path/to/file/test.mp4" } }, "id":1 }'

So you just have to change the path to your file and where it is placed. 
 
(2020-04-01, 21:29)feredy2011 Wrote: next - prev - vol- - vol+ - repeat one and all ond off.
You can use the "Input.ExecuteAction" method for that:
Code:
curl -s -X POST http://127.0.0.1:8080/jsonrpc -H 'Content-Type: application/json' --data '{"jsonrpc": "2.0", "method": "Input.ExecuteAction","params":{"action":"up"},"id":1}'

Just replace the "up" action with what you need and what is mentioned here: https://github.com/xbmc/xbmc/blob/master...p#L25-L247

Or maybe better to read but also probably outdated: https://kodi.wiki/view/Action_IDs   

dear davu thank you . replace "up" with that source code was ok and i can control (playpause - stop - next - prev - vol - mute) but repeat command(one - all - off - random) is not there.
also i test your command for flash memory but dont work . i have a flash memory with name "RAYAN" and 2 folders "light" and "dance" so change your command to :
Code:
curl -s -X POST http://192.168.1.199:80/jsonrpc -H 'Content-Type: application/json' --data '{"jsonrpc": "2.0", "method": "Player.Open", "params": { "item": { "file": "/media/pi/RAYAN/light/1.mp3" } }, "id":1 }'
but dont work . also i dont want play just one music in light folder. i want play folder(all of music on folder).
again thank you for help .
before (in past version) i use 3 command for play folder of felash.
1.clear list :
2.flash and folder
3.start play folder
can you convert this codes with new version? sorry for weak in my english . very very thank you
Reply

Logout Mark Read Team Forum Stats Members Help
{"error":{"code":-32099,"message":"Bad client permission."},"id":1,"jsonrpc":"2.0"}0