Torrent/labels List - WebAPI

Last Updated: Jun 02, 2014 12:01PM PDT

To get the list of all torrents, request http://[IP]:[PORT]/gui/?list=1 . This will return the torrents in the following fashion:

{
	"build": BUILD NUMBER (integer),
	"label": [
	[
	LABEL (string),
	TORRENTS IN LABEL (integer)	],
	...
	],
	"torrents": [
	[
	HASH (string),
	STATUS* (integer),
	NAME (string),
	SIZE (integer in bytes),
	PERCENT PROGRESS (integer in per mils),
	DOWNLOADED (integer in bytes),
	UPLOADED (integer in bytes),
	RATIO (integer in per mils),
	UPLOAD SPEED (integer in bytes per second),
	DOWNLOAD SPEED (integer in bytes per second),
	ETA (integer in seconds),
	LABEL (string),
	PEERS CONNECTED (integer),
	PEERS IN SWARM (integer),
	SEEDS CONNECTED (integer),
	SEEDS IN SWARM (integer),
	AVAILABILITY (integer in 1/65535ths),
	TORRENT QUEUE ORDER (integer),
	REMAINING (integer in bytes)	],
	...
	],
	"torrentc": CACHE ID** (string integer)	}
 

* STATUS: The STATUS is a bitfield represented as integers, which is obtained by adding up the different values for corresponding statuses:

  • 1 = Started
  • 2 = Checking
  • 4 = Start after check
  • 8 = Checked
  • 16 = Error
  • 32 = Paused
  • 64 = Queued
  • 128 = Loaded

For example, if a torrent job has a status of 201 = 128 + 64 + 8 + 1, then it is loaded, queued, checked, and started. A bitwise AND operator should be used to determine whether the given STATUS contains a particular status.

** CACHE ID: The CACHE ID is a number randomly generated by BitTorrent for the given data. By requesting the torrent list using http://[IP]:[PORT]/gui/?list=1&cid=[CACHE ID], only the items that have changed since the list corresponding to the CACHE ID was sent will be returned. This is used to minimize bandwidth usage and simplify parsing by decreasing the amount of data sent by BitTorrent. In this situation, two new dictionary keys replace "torrents," and the returned JSON will look as follows:

{
	"build": BUILD NUMBER (integer),
	"label": [
	[
	LABEL (string),
	TORRENTS IN LABEL (integer)	],
	...
	],
	"torrentp": [
	[
	HASH (string),
	STATUS (integer),
	NAME (string),
	SIZE (integer in bytes),
	PERCENT PROGRESS (integer in per mils),
	DOWNLOADED (integer in bytes),
	UPLOADED (integer in bytes),
	RATIO (integer in per mils),
	UPLOAD SPEED (integer in bytes per second),
	DOWNLOAD SPEED (integer in bytes per second),
	ETA (integer in seconds),
	LABEL (string),
	PEERS CONNECTED (integer),
	PEERS IN SWARM (integer),
	SEEDS CONNECTED (integer),
	SEEDS IN SWARM (integer),
	AVAILABILITY (integer in 1/65535ths),
	TORRENT QUEUE ORDER (integer),
	REMAINING (integer in bytes)        ],
	...
	],
	"torrentm": [
	HASH (string),
	...
	]
	"torrentc": CACHE ID (string integer)	}
 

The "torrentp" array contains a list of torrent jobs that have changed since the corresponding CACHE ID and is identical to the "torrents" array in format. The "torrentm" array contains a list of hashes for torrent jobs that have been removed since the corresponding CACHE ID. A new CACHE ID will be given in torrentc and this can be used for the next list request.

Are you a Pro customer? Contact our support team