authRequest

MessageType: "authRequest"
Payload: {"ClientAuthString": ClientAuthString}

Required Payload: "ClientAuthString" //Must be in this EXACT format

Expects: String containing a signed token from the server

Example Payload: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjbGllbnROYW1lIjoiZ29Ub3JyZW50V2ViVUkiLC Jpc3MiOiJnb1RvcnJlbnRTZXJ2ZXIifQ.zvNAeunNp4DTICaY-SrbVRAoekLGkzQ51SfwkjhZnZY"

Optional Payload: NONE

Returns: Nothing, will now allow other commands if authentication succeeds.

Notes: The "authRequest" MUST be the first message sent to the server before it will accept any other messages

newAuthToken

MessageType: "newAuthToken"
Payload: {"ClientName": ClientName}

Required Payload: "ClientName" //Must be in this EXACT format

Expects: String containing a string with the client name (up to the user to define)

Optional Payload: NONE

Returns: tokenReturn

Notes:

torrentListRequest

Fetches all of the torrents currently stored in the client

MessageType: "torrentListRequest"

Required Payload: NONE

Expects: Only a MessageType of "torrentListRequest", nothing else

Returns: torrentList

torrentFileListRequest

Fetches a list of files for a single torrent

MessageType: "torrentFileListRequest",
Payload: {"FileListHash": selectionHash}

Required Payload: "FileListHash"

Expects: string The hash of the torrent file we are requesting the files for

Example:

Optional Payload: NONE

Returns: []torrentFileList //Array of torrent file structs torrentFileList

Notes:

torrentPeerListRequest

Fetches a list of current peers for a single torrent

MessageType: "torrentPeerListRequest",
Payload: {"PeerListHash": selectionHash}

Required Payload: "PeerListHash"

Expects: string The hash of the torrent file we are requesting the peers for

Example:

Optional Payload: NONE

Returns: torrentPeerList

Notes: This API call will most likely change heavily in the future!

fetchTorrentsByLabel

Fetches a list of torrents by their label

MessageType: "torrentPeerListRequest",
Payload: {"Label": searchLabel}

Required Payload: "Label"

Expects: string The label string that you want to search for

Example: {"Label" : "RSS"} //Will search the database for torrents with RSS label

Optional Payload: NONE

Returns: torrentList //Filtered by label

Notes: API does not support an array of labels to search for

changeStorageValue

Changes where the finished torrent will be stored.

MessageType: "changeStorageValue",
Payload: {"ChangeStorageHashes": [selectionHashes], "StorageValue": storageValue} //the selection hashes and new store value

Required: "ChangeStorageHashes", "StorageValue"

Expects:

"ChangeStorageHashes" -> []string //array of strings containing the hash values for the selected torrents

"StorageValue" -> string //the absolute or relative path to the new storage location (server will convert to absolute path on upload

Example: , "C:\Users\Test\Desktop"

Optional Payload: NONE

Returns:

Notes:

magnetLinkSubmit

Submits a magnet link (or links) to the server to add the torrent

MessageType: "magnetLinkSubmit",
Payload: {"MagnetLinks": [magnetLinks], "StorageValue": storageValue, "Label": userLabel}

Required: "MagnetLinks"

Expects: "MagnetLinks" -> []string // Expects an array of magnet links

Example: [magnet...] //magnet links must start with magnet

Optional Payload: "StorageValue" -> string //absolute or relative path, will be converted to absolute path on server

"Label" -> string //String containing the requested label to be attached to the torrent

Returns: serverPushMessage

Notes: MUST be an array even for single magnetlink

torrentFileSubmit

Submits a torrent file to the server to add the torrent

MessageType: "torrentFileSubmit",
Payload: {"FileData": base64data, "FileName": filename, "StorageValue": storageValue, "Label": userLabel}

Required: "FileData", "FileName"

Expects: "FileData" -> Base64 encoded string //The file must be converted a base64 encoded string and streamed to the server in this way. PLEASE SEE NOTES

"FileName" -> string //Full name of the file INCLUDING the ".torrent" extension

Example:

Optional Payload: "StorageValue" -> string //absolute or relative path, will be converted to absolute path on server

"Label" -> string //String containing the requested label to be attached to the torrent

Returns: serverPushMessage

Notes: The way Chrome and Firefox JS implementations encode base64 appears to be different... if you are doing your base64 encoding I encourage it to be in this format: "base64," THEN your base64 data, since the server will split the response by the comma position and throw away the first part.

If the comma is not there the server will reject the submission.

startTorrents

Stops the selected torrents on the server

MessageType: "startTorrents",
Payload: {"TorrentHashes": [selectionHashes] }

Required: "TorrentHashes"

Expects: "TorrentHashes" -> []string //Array of torrent hashes

Example:

Optional Payload: NONE

Returns: serverPushMessage

Notes:

stopTorrents

Stops the selected torrents on the server

MessageType: "stopTorrents",
Payload: {"TorrentHashes": [selectionHashes] }

Required: "TorrentHashes"

Expects: "TorrentHashes" -> []string //Array of torrent hashes

Example:

Optional Payload: NONE

Returns: serverPushMessage

Notes:

deleteTorrents

Deletes the submitted torrents (and has the option to delete the downloaded data as well as the torrent)

 MessageType: "deleteTorrents",
 Payload: {"TorrentHashes": [selectionHashes], "WithData": withData }

Required: "TorrentHashes", "WithData"

Expects: "TorrentHashes" -> []string //Array of torrent hashes

"WithData" -> bool // True to delete the downloaded data as well, false to just delete the torrent from the client

Example:

Optional Payload: NONE

Returns: serverPushMessage

Notes:

forceUploadTorrents

Stops the selected torrents on the server

 MessageType: "forceUploadTorrents",
 Payload: {"TorrentHashes": [selectionHashes] }

Required: "TorrentHashes"

Expects: "TorrentHashes" -> []string //Array of torrent hashes

Example:

Optional Payload: NONE

Returns: serverPushMessage

Notes:

setFilePriority

Sets the file priority for the selected files for the selected torrent

MessageType: "setFilePriority",
Payload: {"TorrentHash": torrentHash, "FilePriority": filePriority, "FilePaths": [filePaths]}

Required: "TorrentHash", "FilePriority", "FilePaths"

Expects: "TorrentHash" -> string //String of a single torrent hash

"FilePriority" -> string "High"/"Normal"/"Cancel" //Tells the server what priority to set the selected files at

"FilePaths" -> []string //Contains the relative filepath for the files that need a priority change (used to match the files on the server)

Example:

Optional Payload: NONE

Returns: serverPushMessage

Notes: "FilePaths" can be determined by querying the sever for torrentFileListRequest

settingsFileRequest

Returns the settings for the server

MessageType: "settingsFileRequest",

Required: None

Example:

Optional Payload: NONE

Returns: settingsFile

Notes:

rssFeedRequest

Returns the total number of feeds and the URL's for your RSS feeds

 MessageType: "rssFeedRequest",

Required: Just the MessageType

Optional Payload: NONE

Returns: rssList

Notes:

addRSSFeed

Adds an RSS feed to the database

MessageType: "addRSSFeed",
Payload: {"RSSURL": rssURL}

Required: "RSSURL"

Expects: string //containing a full RSS URL

Example: Any URL that provides magnet links in the "Link" field will work

Optional Payload: NONE

Returns: serverPushMessage

Notes:

deleteRSSFeed

Deletes an RSS feed from the database

  MessageType: "deleteRSSFeed",
  Payload: {"RSSURL": rssURL}

Required: "RSSURL"

Expects: string //containing a full RSS URL

Example: Any RSS URL already in the database

Optional Payload: NONE

Returns: serverPushMessage

Notes:

rssTorrentsRequest

Fetches all of the found magnet links in an RSS feed

  MessageType: "rssTorrentsRequest",
  Payload: {"RSSURL": rssURL}

Required:

Expects: string //containing a full RSS URL

Example: Any RSS URL that is already in the database

Optional Payload: NONE

Returns: rssTorrentList

Notes: