2008-05-10 14:29:59 +00:00
|
|
|
1. Introduction
|
|
|
|
|
|
|
|
This document describes a protocol for interacting with Transmission
|
|
|
|
sessions remotely.
|
|
|
|
|
2008-05-10 16:11:00 +00:00
|
|
|
1.1 Terminology
|
|
|
|
|
2008-05-10 14:29:59 +00:00
|
|
|
The JSON terminology in RFC 4627 is used. "array" is equivalent
|
|
|
|
to a benc list; "object" is equivalent to a benc dictionary;
|
2008-05-22 16:59:51 +00:00
|
|
|
and an object's "keys" are the dictionary's string keys.
|
2008-05-10 14:29:59 +00:00
|
|
|
|
|
|
|
2. Message Format
|
|
|
|
|
2008-05-12 00:41:55 +00:00
|
|
|
Messages are formatted in a subset of JSON that understands
|
2008-05-10 14:29:59 +00:00
|
|
|
arrays, maps, strings, and whole numbers with no exponentials --
|
2008-05-13 17:31:09 +00:00
|
|
|
in short, the subset of JSON easily represented as bencoded data.
|
|
|
|
Floating-point numbers are represented as strings.
|
|
|
|
Booleans are represented as integers where 0 is false and 1 is true.
|
2008-05-10 14:29:59 +00:00
|
|
|
|
2008-05-13 17:31:09 +00:00
|
|
|
Messages are represented as JSON objects. There are two types:
|
2008-05-12 23:51:17 +00:00
|
|
|
requests (described in 2.1) and responses (described in 2.2).
|
2008-05-10 14:29:59 +00:00
|
|
|
|
2008-05-12 23:51:17 +00:00
|
|
|
2.1. Requests
|
2008-05-10 14:29:59 +00:00
|
|
|
|
2008-05-12 23:51:17 +00:00
|
|
|
Requests supports three keys:
|
2008-05-10 14:29:59 +00:00
|
|
|
|
2008-05-12 23:51:17 +00:00
|
|
|
(1) A required "method" string telling the name of the method to invoke
|
2008-05-22 16:59:51 +00:00
|
|
|
(2) An optional "arguments" object of key/value pairs
|
|
|
|
(3) An optional "tag" integer used by clients to track responses.
|
2008-05-12 23:51:17 +00:00
|
|
|
If provided by a request, the response MUST include the same tag.
|
2008-05-10 14:29:59 +00:00
|
|
|
|
2008-05-12 23:51:17 +00:00
|
|
|
2.2. Responses
|
2008-05-10 14:29:59 +00:00
|
|
|
|
2008-05-12 23:51:17 +00:00
|
|
|
Reponses support three keys:
|
2008-05-10 14:29:59 +00:00
|
|
|
|
2008-05-10 22:03:03 +00:00
|
|
|
(1) A required "result" string whose value must be "success" on success,
|
2008-05-12 23:51:17 +00:00
|
|
|
or an error string on failure.
|
2008-05-22 16:59:51 +00:00
|
|
|
(2) An optional "arguments" object of key/value pairs
|
2008-05-12 23:51:17 +00:00
|
|
|
(3) An optional "tag" integer as described in 2.1.
|
2008-05-10 14:29:59 +00:00
|
|
|
|
2008-05-22 19:24:11 +00:00
|
|
|
2.3. Transport Mechanism
|
2008-05-15 05:11:50 +00:00
|
|
|
|
2008-05-22 19:24:11 +00:00
|
|
|
POSTing a JSON-encoded request is the preferred way of communicating
|
|
|
|
with the Transmission server; however, a simple notation also exists
|
|
|
|
for sending requests in the query portion of a URL.
|
2008-05-15 05:11:50 +00:00
|
|
|
|
2008-05-22 19:24:11 +00:00
|
|
|
The URL notation works as follows:
|
2008-05-15 05:11:50 +00:00
|
|
|
(1) Any key not "tag" or "method" is assumed to be in "arguments".
|
|
|
|
(2) The "arguments" key isn't needed, since data isn't nested.
|
|
|
|
(3) If the entire value in a key/value pair can be parsed as an integer,
|
|
|
|
it's parsed into a JSON number.
|
|
|
|
Otherwise, if the value can be parsed as comma-delimited integers,
|
|
|
|
it's parsed into a JSON array of integers.
|
|
|
|
Otherwise, the value is treated as a string.
|
|
|
|
|
|
|
|
Examples:
|
|
|
|
?method=torrent-start&ids=1,2
|
|
|
|
?method=session-set&speed-limit-down=50&speed-limit-down-enabled=1
|
|
|
|
|
2008-05-10 14:29:59 +00:00
|
|
|
3. Torrent Requests
|
|
|
|
|
2008-05-12 00:41:55 +00:00
|
|
|
3.1. Torrent Action Requests
|
2008-05-10 14:29:59 +00:00
|
|
|
|
2008-05-20 23:58:59 +00:00
|
|
|
Method name | libtransmission function
|
|
|
|
--------------------+-------------------------------------------------
|
|
|
|
"torrent-remove" | tr_torrentRemove
|
|
|
|
"torrent-start" | tr_torrentStart
|
|
|
|
"torrent-stop" | tr_torrentStop
|
|
|
|
"torrent-verify" | tr_torrentVerify
|
2008-05-12 23:51:17 +00:00
|
|
|
|
2008-05-13 17:31:09 +00:00
|
|
|
Request arguments: "ids", a list of torrent id integers, sha1 hash strings,
|
2008-05-12 00:41:55 +00:00
|
|
|
or both. These are the torrents that the request will
|
|
|
|
be applied to. If "ids" is ommitted, the request is
|
|
|
|
applied to all torrents.
|
2008-05-12 23:51:17 +00:00
|
|
|
|
2008-05-13 17:31:09 +00:00
|
|
|
Response arguments: none
|
2008-05-10 14:29:59 +00:00
|
|
|
|
2008-05-16 07:31:22 +00:00
|
|
|
3.2. Torrent List
|
|
|
|
|
2008-05-22 19:24:11 +00:00
|
|
|
An overview list of torrents.
|
|
|
|
|
2008-05-16 07:31:22 +00:00
|
|
|
Method name: "torrent-list".
|
|
|
|
|
|
|
|
Request arguments: none.
|
|
|
|
|
2008-05-22 19:24:11 +00:00
|
|
|
Response arguments: "list", an array of objects that contain seven keys:
|
|
|
|
|
|
|
|
key | value type
|
|
|
|
--------------------+-------------------------------------------------
|
|
|
|
"hashString" | string
|
|
|
|
"id" | number
|
|
|
|
"name" | string
|
|
|
|
"rateDownload" | double
|
|
|
|
"rateUpload" | double
|
|
|
|
"ratio" | double
|
2008-05-16 07:31:22 +00:00
|
|
|
|
|
|
|
3.3. Torrent Info Requests
|
2008-05-10 14:29:59 +00:00
|
|
|
|
2008-05-12 23:51:17 +00:00
|
|
|
Method name: "torrent-info".
|
|
|
|
|
2008-05-18 16:44:30 +00:00
|
|
|
Request arguments: 3.1's optional "ids" argument.
|
2008-05-10 14:29:59 +00:00
|
|
|
|
2008-05-18 16:44:30 +00:00
|
|
|
Response arguments: "torrent-info", an array of objects based on
|
|
|
|
libtransmission's tr_info struct but different in the following ways:
|
|
|
|
(1) the torrent's "id" field is added.
|
|
|
|
(2) tr_info's "hash" field is omitted.
|
|
|
|
(3) tr_info's "pieces" field is omitted.
|
2008-05-22 16:59:51 +00:00
|
|
|
(4) tr_file's only included pieces are "name" and "length".
|
2008-05-10 14:29:59 +00:00
|
|
|
|
2008-05-18 16:44:30 +00:00
|
|
|
Note that this is a fairly high-bandwidth request and that its results
|
|
|
|
don't change. You should try to cache its results instead of re-calling it.
|
2008-05-10 14:29:59 +00:00
|
|
|
|
|
|
|
Example Request:
|
|
|
|
|
|
|
|
{
|
2008-05-18 16:44:30 +00:00
|
|
|
"arguments": { "ids": [ 7, 10 ] }
|
2008-05-12 23:51:17 +00:00
|
|
|
"method": "torrent-info",
|
2008-05-13 17:31:09 +00:00
|
|
|
"tag": 39693
|
2008-05-10 14:29:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Example Response:
|
|
|
|
|
|
|
|
{
|
2008-05-13 17:31:09 +00:00
|
|
|
"tag": 39693
|
2008-05-12 23:51:17 +00:00
|
|
|
"result": "success",
|
|
|
|
"arguments": {
|
2008-05-18 16:44:30 +00:00
|
|
|
"torrent-info": [
|
|
|
|
{
|
|
|
|
"id": 7,
|
|
|
|
"name": "Ubuntu x86_64 DVD",
|
|
|
|
"pieceCount": 1209233,
|
|
|
|
"pieceSize": 4096,
|
|
|
|
"totalSize": 9803930483,
|
|
|
|
...
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": 10,
|
|
|
|
"name": "Ubuntu i386 DVD",
|
|
|
|
"pieceCount": 83943,
|
|
|
|
"pieceSize": 12345,
|
|
|
|
"totalSize": 2398480394,
|
|
|
|
...
|
|
|
|
}
|
|
|
|
]
|
2008-05-10 14:29:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-05-16 07:31:22 +00:00
|
|
|
3.4. Torrent Status Requests
|
2008-05-10 14:29:59 +00:00
|
|
|
|
2008-05-12 23:51:17 +00:00
|
|
|
Method name: "torrent-status"
|
|
|
|
|
2008-05-18 16:44:30 +00:00
|
|
|
Request arguments: 3.1's optional "ids" argument.
|
2008-05-10 14:29:59 +00:00
|
|
|
|
2008-05-22 16:59:51 +00:00
|
|
|
Response arguments: "torrent-status", an array of objects
|
|
|
|
identical to libtransmission's tr_stat struct.
|
2008-05-10 14:29:59 +00:00
|
|
|
|
2008-05-16 07:31:22 +00:00
|
|
|
3.5. Adding a Torrent
|
2008-05-10 14:29:59 +00:00
|
|
|
|
2008-05-12 23:51:17 +00:00
|
|
|
Method name: "torrent-add"
|
|
|
|
|
2008-05-10 16:38:42 +00:00
|
|
|
Request arguments:
|
2008-05-10 14:29:59 +00:00
|
|
|
|
|
|
|
string | value type & description
|
|
|
|
-------------------+-------------------------------------------------
|
2008-05-15 05:11:50 +00:00
|
|
|
"download-dir" | string path to download the torrent to
|
2008-05-10 16:11:00 +00:00
|
|
|
"filename" | string location of the .torrent file
|
2008-05-20 17:33:54 +00:00
|
|
|
"metainfo" | string base64-encoded .torrent content
|
2008-05-13 17:31:09 +00:00
|
|
|
"paused" | boolean if true, don't start the torrent
|
2008-05-12 16:33:17 +00:00
|
|
|
"peer-limit" | int maximum number of peers
|
2008-05-10 14:29:59 +00:00
|
|
|
|
2008-05-20 17:33:54 +00:00
|
|
|
Either "filename" OR "metainfo" must be included.
|
|
|
|
All other arguments are optional.
|
2008-05-10 14:29:59 +00:00
|
|
|
|
2008-05-12 13:05:06 +00:00
|
|
|
Response arguments: on success, a "torrent-added" object in the
|
2008-05-16 07:31:22 +00:00
|
|
|
form of one of 3.3's tr_info objects.
|
2008-05-10 14:29:59 +00:00
|
|
|
|
2008-05-22 16:59:51 +00:00
|
|
|
3.6. Other Torrent Settings
|
2008-05-10 22:03:03 +00:00
|
|
|
|
|
|
|
Common arguments:
|
|
|
|
|
2008-05-12 23:51:17 +00:00
|
|
|
string | value type & description
|
|
|
|
---------------------------+-------------------------------------------------
|
|
|
|
"peer-limit" | int maximum number of peers
|
|
|
|
"speed-limit-down" | int maximum download speed (in KiB/s)
|
|
|
|
"speed-limit-down-enabled" | boolean true if the download speed is limited
|
|
|
|
"speed-limit-up" | int maximum upload speed (in KiB/s)
|
|
|
|
"speed-limit-up-enabled" | boolean true if the upload speed is limited
|
2008-05-10 22:03:03 +00:00
|
|
|
|
2008-05-16 07:31:22 +00:00
|
|
|
3.6.1. Mutators
|
2008-05-10 22:03:03 +00:00
|
|
|
|
2008-05-12 23:51:17 +00:00
|
|
|
Method name: "torrent-set"
|
2008-05-16 07:31:22 +00:00
|
|
|
Request arguments: 3.1's "ids", plus one or more of 3.6's arguments
|
2008-05-10 22:03:03 +00:00
|
|
|
Response arguments: none
|
|
|
|
|
2008-05-16 07:31:22 +00:00
|
|
|
3.6.2. Accessors
|
2008-05-10 22:03:03 +00:00
|
|
|
|
2008-05-12 23:51:17 +00:00
|
|
|
Method name: "torrent-get"
|
2008-05-10 22:03:03 +00:00
|
|
|
Request arguments: none
|
2008-05-12 13:05:06 +00:00
|
|
|
Response arguments: A "torrents" list of objects containing all
|
2008-05-22 16:59:51 +00:00
|
|
|
of 3.6's arguments plus the torrent's "id" field.
|
2008-05-12 00:41:55 +00:00
|
|
|
|
2008-05-10 22:03:03 +00:00
|
|
|
|
2008-05-16 07:31:22 +00:00
|
|
|
3.7 File Priorities
|
2008-05-10 22:03:03 +00:00
|
|
|
|
|
|
|
Common arguments:
|
|
|
|
|
|
|
|
string | value type & description
|
|
|
|
-------------------+-------------------------------------------------
|
2008-05-15 05:11:50 +00:00
|
|
|
"files-wanted" | array indices of one or more file to download
|
|
|
|
"files-unwanted" | array indices of one or more file to not download
|
2008-05-12 13:05:06 +00:00
|
|
|
"priority-high" | array indices of one or more high-priority files
|
|
|
|
"priority-low" | array indices of one or more low-priority files
|
|
|
|
"priority-normal" | array indices of one or more normal-priority files
|
2008-05-10 22:03:03 +00:00
|
|
|
|
2008-05-16 07:31:22 +00:00
|
|
|
3.7.1. Mutators
|
2008-05-10 22:03:03 +00:00
|
|
|
|
2008-05-13 17:31:09 +00:00
|
|
|
Method name: "torrent-set-priorities"
|
2008-05-16 07:31:22 +00:00
|
|
|
Request arguments: 3.1's "ids", plus one or more of 3.7's arguments
|
2008-05-10 22:03:03 +00:00
|
|
|
Response arguments: none
|
|
|
|
|
2008-05-16 07:31:22 +00:00
|
|
|
3.7.2. Accessors
|
2008-05-10 22:03:03 +00:00
|
|
|
|
2008-05-13 17:31:09 +00:00
|
|
|
Method name: "torrent-get-priorities"
|
2008-05-10 22:03:03 +00:00
|
|
|
Request arguments: none
|
2008-05-13 17:31:09 +00:00
|
|
|
Response arguments: A "torrents" list of objects containing all
|
2008-05-16 07:31:22 +00:00
|
|
|
of 3.7's arguments plus the torrent's "id" int.
|
2008-05-10 22:03:03 +00:00
|
|
|
|
2008-05-10 16:38:42 +00:00
|
|
|
4. Session Status Requests
|
2008-05-10 14:29:59 +00:00
|
|
|
|
2008-05-10 16:38:42 +00:00
|
|
|
4.1. Session Arguments
|
2008-05-10 14:29:59 +00:00
|
|
|
|
2008-05-12 16:33:17 +00:00
|
|
|
string | value type & description
|
|
|
|
---------------------------+-------------------------------------------------
|
|
|
|
"encryption" | string "required", "preferred", "tolerated"
|
2008-05-15 05:11:50 +00:00
|
|
|
"download-dir" | string default path to download torrents
|
2008-05-12 16:33:17 +00:00
|
|
|
"peer-limit" | int maximum global number of peers
|
2008-05-13 17:31:09 +00:00
|
|
|
"pex-allowed" | boolean true means allow pex in public torrents
|
2008-05-12 16:33:17 +00:00
|
|
|
"port" | int port number
|
|
|
|
"port-forwarding-enabled" | boolean true means enabled.
|
|
|
|
"speed-limit-down" | int max global download speed (in KiB/s)
|
|
|
|
"speed-limit-down-enabled" | int max global download speed (in KiB/s)
|
|
|
|
"speed-limit-up" | int max global upload speed (in KiB/s)
|
|
|
|
"speed-limit-up-enabled" | int max global upload speed (in KiB/s)
|
2008-05-10 14:29:59 +00:00
|
|
|
|
2008-05-10 16:38:42 +00:00
|
|
|
4.2. Mutators
|
|
|
|
|
2008-05-12 23:51:17 +00:00
|
|
|
Method name: "session-set"
|
2008-05-10 22:14:19 +00:00
|
|
|
Request arguments: one or more of 4.1's arguments
|
2008-05-10 16:38:42 +00:00
|
|
|
Response arguments: none
|
|
|
|
|
2008-05-10 14:29:59 +00:00
|
|
|
4.2. Accessors
|
|
|
|
|
2008-05-12 23:51:17 +00:00
|
|
|
Method name: "session-get"
|
2008-05-10 14:29:59 +00:00
|
|
|
Request arguments: none
|
2008-05-10 22:14:19 +00:00
|
|
|
Response arguments: all of 4.1's arguments
|
2008-05-10 14:29:59 +00:00
|
|
|
|