you are using the wrong order....you have to send something like {"id": 1, "method": "savemessage", "params": { "*message*": "variableholdingmessage", "*uid*" : "variableholdingmail"}}
*message* and *uid* are the named parameters to your function def savemessage(*message, uid*) and instead you are composing {"id": 1, "method": "savemessage", "params": { "variableholdingmessage": "mymessage", "variableholdinguid" : "myemail@localhost"}} PS: you are using probably the overcomplicated quoting style ever :P try with this -d '{"id": 1, "method": "savemessage", "params": { "message": "'$message'", "uid" : "'$uid'"}}' $url PS2: relying on a vanilla bash variable for passing around json parameters is a bad idea. What if your message includes a ' symbol ? e.g. "Let's rock".... The json equivalent is "Let\'s rock"... --