FT Remote Protocols
Protocol Definitions for Enterprise Download Remote
The Protocol definition is divided in three parts:
* General:
Name: Name of the Protocol
Version: Version of the Protocol Specification
UseToken: Did you need to use a Token in the Communication to the Client Protocol
User: Did you need to login with a User to the WebService
Password: Did you need to login with a Password to the WebService
* Protocol Queries
Each function in the App does have a corresponding Query URL to the Webservice. The Query URL could be only the Query URL, which passes the Parameters within the URL like:
<urlGetFiles>https://[IP]:[PORT]/api/?todo=getfiles&token=[TOKEN]&filehash=[FILEREFERENCE]</urlGetFiles>
Or have a URL and a POST Body, if the Backend Client Program needs to be controlled by data in the Post Body like:
<urlGetList>https://[IP]:[PORT]/jsonrpc</urlGetList> <urlGetListPostBody><![CDATA[{"jsonrpc":"2.0", "id":"qwer","method":"aria2.tellActive","params":[]}]]></urlGetListPostBody>
The App Replaces the following Keywords with the corresponding Variables from the App in runtime:
[IP] = The IP Address of the Backend Programm
[PORT] = The Port the Backend Program Listen
[TOKEN] = If there is a Token needed, the Token Replacement parameter
[FILEREFERENCE] = The File Reference which is the actual used file (See later the mapping „hash“)
[ADDURL] = The Placeholder for adding a URL
* Mappings
Currently there is a Mapping for JSON implemented (and a very rudimentairy XML mapping) which works as follows. In the header you specify the Type of the Webservice Response, Which is JSON in this case:
<parseListOfFiles type='JSON'>
Mapping works as follows:
Does mean to Map the JSON Key-Value pair named „status“ on JSON level 0 to the internal Variable „status“
<status>/status</status>
Does mean to Map the JSON Key-Value pair named „path“ on JSON level 2 – within a JSON Array at position 0 – within a JSON Key-Value Pair named „files“, to the internal Variable „name“
<name>/files/ARRAY0/path</name>
The first two mappings, serverInfo and serverVersion are mappings for the Server Information displayed in the Title header in the App (Should be Version etc)
<serverInfo>/build</serverInfo> <serverVersion>/aria2</serverVersion>
The next „packageArray“ ist the Array of files which is returned by the Web Service – This needs to be an array
<packageArray>/result</packageArray>
If the result for Mapping is a Array and not a Key-Value response, you could speciy it by simply enter the Position into the XML description like:
<status>1</status> <name>2</name>
The rudimentary support for XML Responses is like the following example, which means to select the value by xpath at location //div[@id=’token‘]
<level order='1' type='xpath'>//div[@id='token']</level>
The rest of the mappings are quite self-explanatory
Following is the ARIA2 Protocol Specification built in, into the App
Aria2 Protocol Definiton:
<?xml version="1.0" encoding="utf-8" ?> <protocol> <name>Aria2</name> <version>9</version> <useToken>NO</useToken> <user>YES</user> <password>YES</password> <urlToken></urlToken> <urlGetList>https://[IP]:[PORT]/jsonrpc</urlGetList> <urlGetListPostBody><![CDATA[{"jsonrpc":"2.0", "id":"qwer","method":"aria2.tellActive","params":[]}]]></urlGetListPostBody> <urlGetListPaused>https://[IP]:[PORT]/jsonrpc</urlGetListPaused> <urlGetListPausedPostBody><![CDATA[{"jsonrpc":"2.0", "id":"qwer","method":"aria2.tellWaiting","params":[0,99]}]]></urlGetListPausedPostBody> <urlGetListStopped>https://[IP]:[PORT]/jsonrpc</urlGetListStopped> <urlGetListStoppedPostBody><![CDATA[{"jsonrpc":"2.0", "id":"qwer","method":"aria2.tellStopped","params":[0,99]}]]></urlGetListStoppedPostBody> <urlGetFiles>https://[IP]:[PORT]/jsonrpc</urlGetFiles> <urlGetFilesPostBody><![CDATA[{"jsonrpc":"2.0", "id":"qwer","method":"aria2.getFiles","params":["[HASH]"]}]]></urlGetFilesPostBody> <urlStart></urlStart> <urlStop>https://[IP]:[PORT]/jsonrpc</urlStop> <urlStopPostBody><![CDATA[{"jsonrpc":"2.0", "id":"qwer","method":"aria2.remove","params":["[HASH]"]}]]></urlStopPostBody> <urlPause>https://[IP]:[PORT]/jsonrpc</urlPause> <urlPausePostBody><![CDATA[{"jsonrpc":"2.0", "id":"qwer","method":"aria2.pause","params":["[HASH]"]}]]></urlPausePostBody> <urlUnPause>https://[IP]:[PORT]/jsonrpc</urlUnPause> <urlUnPausePostBody><![CDATA[{"jsonrpc":"2.0", "id":"qwer","method":"aria2.unpause","params":["[HASH]"]}]]></urlUnPausePostBody> <urlForceStart></urlForceStart> <urlRecheckDownload></urlRecheckDownload> <urlRemoveDownload>https://[IP]:[PORT]/jsonrpc</urlRemoveDownload> <urlRemoveDownloadPostBody><![CDATA[{"jsonrpc":"2.0", "id":"qwer","method":"aria2.remove","params":["[HASH]"]}]]></urlRemoveDownloadPostBody> <urlRemoveDataDownload></urlRemoveDataDownload> <urlAddUrl>https://[IP]:[PORT]/jsonrpc</urlAddUrl> <urlAddUrlPostBody><![CDATA[{"jsonrpc":"2.0", "id":"qwer","method":"aria2.addUri","params":[["[ADDURL]"]]}]]></urlAddUrlPostBody> <urlSetPrio></urlSetPrio> <parseToken /> <parseListOfFiles type='JSON'> <mapping> <serverInfo>/build</serverInfo> <serverVersion>/aria2</serverVersion> <packageArray>/result</packageArray> <hash>/gid</hash> <status>/status</status> <name>/files/ARRAY0/path</name> <bytes>/totalLength</bytes> <downloadPercentDone></downloadPercentDone> <downloadBytesDone>/completedLength</downloadBytesDone> <uploadBytesDone></uploadBytesDone> <ratio></ratio> <uploadSpeed>/uploadSpeed</uploadSpeed> <downloadSpeed>/downloadSpeed</downloadSpeed> <eta></eta> <description>/infoHash</description> <connectedPeers></connectedPeers> <foundPeers></foundPeers> <connectedSeeds>/numSeeders</connectedSeeds> <foundSeeds></foundSeeds> <availability></availability> <positionWaiting></positionWaiting> <missingBytes></missingBytes> <textStatus>/status</textStatus> <filenameLocal>/dir</filenameLocal> </mapping> </parseListOfFiles> <parseGetFile type='JSON'> <mapping> <packageArray>/result</packageArray> <filename>/path</filename> <size>/length</size> <downloaded>/completedLength</downloaded> <priority></priority> </mapping> </parseGetFile> </protocol>