rpc "torrent-get" help

Discussion of the Web Interface for Transmission, formerly known as Clutch. This applies to all version of Transmission
Post Reply
dchoe
Posts: 4
Joined: Thu Apr 16, 2009 6:05 pm

rpc "torrent-get" help

Post by dchoe »

I keep getting an error whenever I try to use torrent-get via POST (no method-name) and GET (no fields supplied). I am able to get all the other RPC methods to work.
Jordan
Transmission Developer
Posts: 2312
Joined: Sat May 26, 2007 3:39 pm
Location: Titania's Room

Re: rpc "torrent-get" help

Post by Jordan »

Could you post to the forum an example of the JSON torrent-get request you're POSTing to Transmission?
dchoe
Posts: 4
Joined: Thu Apr 16, 2009 6:05 pm

Re: rpc "torrent-get" help

Post by dchoe »

right now, i've just beein trying to get it to work using curl.

Code: Select all

curl -d "method=torrent-get" localhost:8081/transmission/rpc
{
    "arguments": {}, 
    "result": "no method name"
}

curl localhost:8080/transmission/rpc?method=torrent-get
{
    "arguments": {
        "torrents": []
    }, 
    "result": "no fields specified"
}

curl localhost:8080/transmission/rpc?method=torrent-get?fields=name
{
    "arguments": {
        "torrents": []
    }, 
    "result": "no fields specified"
}
Jordan
Transmission Developer
Posts: 2312
Joined: Sat May 26, 2007 3:39 pm
Location: Titania's Room

Re: rpc "torrent-get" help

Post by Jordan »

The method name needs to be in the JSON, not in the http headers. This is true for all the requests.
dchoe
Posts: 4
Joined: Thu Apr 16, 2009 6:05 pm

Re: rpc "torrent-get" help

Post by dchoe »

i'm trying to create a greasemonkey script and am able to add a torrent using this:

Code: Select all

var addstring = "/transmission/rpc?method=torrent-add&filename=" + window.findhrefs(event.target) + "";
GM_xmlhttpRequest({
	method: 'GET',
	url: server + addstring,
	onload: function(responseDetails) {
		alert ( "Torrent Added" );
	}
});
and when i try to use torrent-get, doesn't work:

Code: Select all

var rpcstring="/transmission/rpc?method=torrent-get";
GM_xmlhttpRequest({
	method: 'GET',
	url: server+rpcstring,
	onload: function(responseDetails) {
		alert (responseDetails.responseText);
	}
});
Jordan
Transmission Developer
Posts: 2312
Joined: Sat May 26, 2007 3:39 pm
Location: Titania's Room

Re: rpc "torrent-get" help

Post by Jordan »

Things will go a lot easier if you POST json requests instead of using the GET hack.

Actually I'm hoping someone will write a rison-to-json parser in C that we can send more sophisticated requests via GET. But until that happens... POST is your friend...
Post Reply