Trouble using HTTP POST



Hi there,
I am trying to log on to my tt-rss server using libsoup. Since version 1.5.3 it only supports HTTP POST to receive data.
Basically I only need to do something like this with libsoup:

curl -d '{"op":"login","user":"you","password":"xxx"}' http://example.dom/tt-rss/api/

But all the code examples written in vala using POST are outdated and don't compile anymore.
For example the last one on this page, Transmission RPC Interface:
https://wiki.gnome.org/Projects/Vala/JsonSample

Here is my code:

var uri = "http://nas/tt-rss/api/";
var session = new Soup.Session ();
var message = new Soup.Message ("POST", uri);
var login = "{\"op\":\"login\",\"user\":\"USER\",\"password\":\"PASSWORD\"}";
message.set_request("", MemoryUse.COPY, login);
session.send_message (message); 
stdout.printf("%s \n", (string) message.response_body.flatten ().data);

I always get the error: "Argument 3: Cannot convert from `string' to `uint8[]'"
Thanks for any help in advance

best regards,
Jan


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]