Help about Input.SendText
#1
Hi

i work on new js library to abstract and simplify the remote call procedure and i need help about Input.SendText

i send request (throw websocket) with this format when my cursor is on input (in edit source title in my case)
Code:
{"id": 0, "jsonrpc"=2.0, "method"="Input.SendText", "params"={"text":"Test text", "done":true}}
OR
{"id": 0, "jsonrpc"=2.0, "method"="Input.SendText", "params"={"text":"Test text", "done":false}}

and i received
Code:
{"id": 0, "jsonrpc"=2.0, "result"="OK"}

But i cant view this "Test text" in input

What's wrong?? the request or the input location ??

thank's
Reply
#2
I have the same problem.
Reply
#3
I found!! ( after really bad sleep)

The problem was the input not the request

You cant "Input.SendText" to this input
Image

Input.SendText send the text to the virtual keyboard
Image


So Input.SendText send the text sequence to the virtual keyboard and nowhere else.

PS: Don't forget "done":false parameters to send "keystroke" if "done":true the SendText send and validate(enter)
Reply
#4
I too am having issues with this command, I am using when virtual keyboard is open too...

I can get just about everything else to work apart from this:

My input:
Code:
http://MY-IP/jsonrpc?request={ "id": "0",  "jsonrpc": "2.0", "method": "Input.SendText",  "Params": { "Text": "MyTextHere",  "done": "false"  } }

Gives me a 200 OK and this response:

Code:
{
  "error": {
    "code": -32602,
    "data": {
      "method": "Input.SendText",
      "stack": {
        "message": "Missing parameter",
        "name": "text",
        "type": "string"
      }
    },
    "message": "Invalid params."
  },
  "id": "0",
  "jsonrpc": "2.0"
}

What am I doing wrong? Is there another parameter I need? if so what is it?

TIA
Reply
#5
The parameter's name is "text" and not "Text" (see capital T in your example). The response tells you that it's missing the "text" parameter because the parameter names are case sensitive.
Always read the online manual (wiki), FAQ (wiki) and search the forum before posting.
Do not e-mail Team Kodi members directly asking for support. Read/follow the forum rules (wiki).
Please read the pages on troubleshooting (wiki) and bug reporting (wiki) before reporting issues.
Reply
#6
(2013-03-26, 23:49)Montellese Wrote: The parameter's name is "text" and not "Text" (see capital T in your example). The response tells you that it's missing the "text" parameter because the parameter names are case sensitive.
Thanks Montellese, I'm glad you responded as I know you pushed this addition...

Anyway I must of pasted my last attempt after the other 100 or so before tbh, and even with the correct "text" (Lower case "t") it is the same response:

Here is my full - rest GET request:
Code:
http://192.168.0.250:80/jsonrpc?request={ "id": "0",  "jsonrpc": "2.0", "method": "Input.SendText",  "Params": { "text": "MyTextHere",  "done": "false"  } }

Code:
{
  "error": {
    "code": -32602,
    "data": {
      "method": "Input.SendText",
      "stack": {
        "message": "Missing parameter",
        "name": "text",
        "type": "string"
      }
    },
    "message": "Invalid params."
  },
  "id": "0",
  "jsonrpc": "2.0"
}

Is there a "message" parameter that is needed (is that what is missing?)? Or could it be that this is missing from the XBMC build I am using altogether? which is the latest Raspbmc btw.....All though like I say all other basic navigation commands are working great, I have been banging my head against a wall for 2 days over this now....
Reply
#7
It should be "params" and not "Params" (again case sensitive) so it doesn't pick up any of the parameters you provide in the call and therefore it doesn't find the required "text" parameter.
Always read the online manual (wiki), FAQ (wiki) and search the forum before posting.
Do not e-mail Team Kodi members directly asking for support. Read/follow the forum rules (wiki).
Please read the pages on troubleshooting (wiki) and bug reporting (wiki) before reporting issues.
Reply
#8
(2013-03-27, 00:59)Montellese Wrote: It should be "params" and not "Params" (again case sensitive) so it doesn't pick up any of the parameters you provide in the call and therefore it doesn't find the required "text" parameter.

Ok Finally sorted my Syntax out I hope, but now I receive an 'Invalid Type String Received' whether I send a letter or a sentance?

My input:
Code:
http://192.168.0.250:80/jsonrpc?request={ "id": "0",  "jsonrpc": "2.0", "method": "Input.SendText",  "params": { "text": "a",  "done": "false"  } }


Response:
Code:
{
  "error": {
    "code": -32602,
    "data": {
      "method": "Input.SendText",
      "stack": {
        "message": "Invalid type string received",
        "name": "done",
        "type": "boolean"
      }
    },
    "message": "Invalid params."
  },
  "id": "0",
  "jsonrpc": "2.0"
}
Reply
#9
I think you should first look at how JSON and JSON-RPC work and then take a closer look at the API. All those mistakes in your request are very basic. Furthermore the error response you get provides you with quite some information on what is wrong.

The value of your "done" parameter (see the "name" property in the error message) is provided as a string ("Invalid type STRING received") but a boolean value (see the "type" property in the error message) is expected so remove the double quotes around "false" in your request.
Always read the online manual (wiki), FAQ (wiki) and search the forum before posting.
Do not e-mail Team Kodi members directly asking for support. Read/follow the forum rules (wiki).
Please read the pages on troubleshooting (wiki) and bug reporting (wiki) before reporting issues.
Reply
#10
(2013-03-27, 02:13)Montellese Wrote: I think you should first look at how JSON and JSON-RPC work and then take a closer look at the API. All those mistakes in your request are very basic. Furthermore the error response you get provides you with quite some information on what is wrong.

The value of your "done" parameter (see the "name" property in the error message) is provided as a string ("Invalid type STRING received") but a boolean value (see the "type" property in the error message) is expected so remove the double quotes around "false" in your request.

Ok I will give it a shot.
Just one point though, you say basic mistakes, I verify everything with JSON Lint (jsonlint.com) and that has set me in good stead working with share price API's, database API's, exchange API's etc, etc, I take it when working with this API that verifying the validity of my data is a pointless excercise?
Reply
#11
No but if you don't use the proper keywords which the API expects it doesn't work. JSON property names must be case sensitive. If the API expects a boolean value, you can't pass it a string. The JSON validation on JSON Lint won't help you there because it doesn't know about the API-specific requirements. It can't know that the value of the "done" parameter should be a boolean and not a string. It's still valid JSON if you pass it as a string but it's simply not what the API expects.
Always read the online manual (wiki), FAQ (wiki) and search the forum before posting.
Do not e-mail Team Kodi members directly asking for support. Read/follow the forum rules (wiki).
Please read the pages on troubleshooting (wiki) and bug reporting (wiki) before reporting issues.
Reply
#12
Ok it seems I have a lot to learn about the inner workings of this API, many thanks for your input on this, Its been a great help! Cool
Reply
#13
Montellese, I got my SendText to work fine with your help from this thread. Now I need to send specific letters over JSON so I can put text into the virtual keyboard. If I use SendText it clears whatever was sent before it. If there a way to send a letter at a time then just press done when you are finished with JSON commands?
Reply
#14
Can't you just reproduce the effect of sending individual keys by having your code store the entire string as it's typed but use the SendText method after each key press?
BBC Live Football Scores: Football scores notifications service.
script.squeezeinfo: shows what's playing on your Logitech Media Server
Reply
#15
I am trying to create a keyboard for irule program json commands to the kodi, but nocmando send text when I send the first texte he does not allow write the second, for instance created text with the letter "a" and the letter "b "but if I hit any of the two he did not add another, only replacing the letter by the other. is there any way to solve?


{"jsonrpc":"2.0","method":"Input.SendText","params": {"text": "A", "done":false},"id":1}
{"jsonrpc":"2.0","method":"Input.SendText","params": {"text": "A", "done":false},"id":1}
Reply

Logout Mark Read Team Forum Stats Members Help
Help about Input.SendText0