Thanks very much Niphlod. I am much closer now..

However I am getting this response:
{"version": "1.1", "id": 1, "error": {"message": "method \"save_message\" 
does not exist", "code": 100, "name": "JSONRPCError"}}

from this script:
url="https://domain.net:8000/ircmessage/rpc/call/jsonrpc";
curl -v -k -X POST -H "Content-Type: application/json" -d '{"id": 1, 
"method": "save_message", "params": { "message": "mymessage", "uid" : 
"myemail@localhost"}}' $url

I guess my url is probably incorrect.

Cheers again Niphlod.

On Wednesday, 7 November 2012 15:16:42 UTC-5, Niphlod wrote:
>
> Yes, but without that I wouldn't have been able to tell you: "Follow the 
> protocol, Mike!" :P
>
> You are publishing a service behind the jsonrpc protocol, but you surely 
> missed on how to interact with them ^_^
>
> Every request per the spec has to carry an id , a method and a params 
> value in the json body of the request.
>
> So, you are trying to fire function that needs 'message' and 'uid' 
> parameters, and the function is called 'save_message'
> The following json must be POSTed (and using single quotes will save you 
> lots of backslashes if you're using cURL)
>
> '{"id": 1, "method": "save_message", "params": { "message": "mymessage", 
> "uid" : "myemail@localhost"}}'
>
> So, the complete cmdline is
> curl -v -k -X POST -H "Content-Type: application/json" -d '{"id": 1, 
> "method": "save_message", "params": { "message": "mymessage", "uid" : 
> "myemail@localhost"}}' $url
>
> This will generate a response like this
> {"error": null, "version": "1.1", "id": 1, "result": {"status": "saved"}}
>
> The 'id' is the one you sent (so, if you POST id=2, the response will hold 
> 2, and so on). In "result" you get what you return in the controller.
>
>
>

-- 



Reply via email to