Kodi Community Forum

Full Version: JSON.RPC input.sendtext not working in curl command
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hi guys,

I want to sent a message from xbmc to xbev software working with python in my laptop, I opened the xbev.py in my laptop and connected with xbmc same network.

I want to sent a text message to xbev to show in the box same instruction from here xbev

I made this command from ssh inside xbmc :
 curl -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"Input.SendText","params":{"text":"MyTextHere","done":"false"},"id":0}' http://ipaddressmylaptop/jsonrpc

but the output like this in ssh xbmc:

×<‡HP_®&û@¸•”¤–¤؟ٌàُپ–¥^
                      h
wXjق؛ر
      '…‏Sذژ=÷:َ‌ˆ¶éLibreELEC:~ # 

nothing show in the xbev interface!

Any help please 

Thanks for all
(2018-09-06, 14:42)Spiderfish Wrote: [ -> ] curl -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"Input.SendText","params":{"text":"MyTextHere","done":"false"},"id":0}' http://ipaddressmylaptop/jsonrpc
The "done"-param's value needs to be a boolean so without the quotes.
EDIT:
Additionally & if I remember correctly: nowadays you need to use POST and I think you need to specify the port as well (if it is something other then the default 80) so that would make something like:
bash:
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"Input.SendText","params":{"text":"MyTextHere","done":false},"id":0}' http://ipaddressmylaptop:webserverport/jsonrpc
So you mean should be like this:

curl -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"Input.SendText","params":{"text":"MyTextHere","done":false},"id":0}' http://ipaddressmylaptop/jsonrpc


Thanks for help
(2018-09-06, 15:01)Spiderfish Wrote: [ -> ]So you mean should be like this:
curl -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"Input.SendText","params":{"text":"MyTextHere","done":false},"id":0}' http://ipaddressmylaptop/jsonrpc
Yes & I edited my initial answer with some additional info that needs to be taken into account.
Tested locally and works for me.
I did it but it the ssh nothing shows and no message in xbev!

ImageImageLibreELEC:~ # 
LibreELEC:~ # curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"Input.SendText","params":{"text":"MyTextHere","done":false},"id":0}' http://192.168.1.253:8080/jsonrpc
curl: (7) Failed to connect to 192.168.1.253 port 8080: Connection timed out
LibreELEC:~ # 
LibreELEC:~ # curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"Input.SendText","params":{"text":"MyTextHere","done":false},"id":0}' http://192.168.1.253:8080/jsonrpc
LibreELEC:~ #
I can not figure out which port I have to use! Undecided
8080 is the default port that Kodi uses for its web interface, which needs to be activated for use.
Yeah it is 8080 that in case if I want to sent to Kodi..but in my case want to sent to xbev.py which is install in my laptop " sending from kodi ssh to laptop"

Like in this example
8080 is the default web port; json is 9090
Yes Thanks for all....now when I send Json rpc from one kodi to another through this cammand: 

curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"Input.SendText","params":{"text":"MyTextHere","done":false},"id":0}' http://192.168.1.253:8080/jsonrpc

I got this successfully debug in the receiver Kodi (192.168.1.253):
 DEBUG: CWebServer[8080]: request received for /jsonrp

But How can I see this message in the receiver Kodi and where is it store ? Huh
Input.SendText should put the text into an input field. If there is not an input field focused it shouldn't do anything. What are you trying to accomplish? Have you looked at the JSON RPC API?
I want to be able to send Message between two kodi users!
But what type of message? If you are wanting a notification to pop up, you would send this JSON:

json:
{"jsonrpc":"2.0","method":"GUI.ShowNotification","params":{"title":"Test","message":"This is a test notification"},"id":0}
Yes I tried this "GUI.ShowNotification" but my issue is this Notification is gone and I need to be on the screen until the user close it by cancel button.
Looking at the API for GUI.ShowNotification there is a duration that can be set, but there is no way to interact with notifications. There are methods to show things like Yes/No dialogs, but those are blocking. They take over the focus of the screen until they're acknowledged. If that doesn't suit your needs then you should start looking into addon development.
Pages: 1 2