CountTus

From Wordfast Wiki
Revision as of 15:37, 20 March 2015 by Remiandre (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Return to command list

countTus

countTus (string key, int cmd)

Count the number of Translation Units of all the TMs.

Parameters

key string a valid API Key, generated by making a share at www.freetm.com
cmd int command number is 501

Returned value

connections array Detail of TUs count for each connection
id int connection ID
tms array TUs counts
tmid int TM ID
privateCount int private TU count
publicCount int public TU count
count int sum of private and public count
error string error messages

Request example

json post with javascript

var data = {};
data["key"] = "example@key";
data["cmd"] = 501;
var xhr = new XMLHttpRequest();
xhr.open("POST", "www.freetm.com/wfa/api", true);
xhr.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
xhr.send(JSON.stringify(data));

post

<form action="www.freetm.com/wfa/api" method="post">
   <input type="text" id="key" name="key" value="example@key"/>
   <input type="text" id="cmd" name="cmd" value="501"/>	
   <input type="submit" value="Submit">				
</form>

get

www.freetm.com/wfa/api?key=example@key&cmd=501

Response example

json

{
 
    "connections": [{
                 "id":      1
                 ,"tms": [{
                            "tmid":1, "privateCount":0, "publicCount":0, "count":0
                      }
                      ,{...}
                  ]                   
                 ,"error":  ""
            }
            ,{...}
    ]      
}

without white space (new line, carriage return or tabulation).

text

id:1 LF
tmid:1 tab privateCount:0 tab publicCount:0 tab count:0 LF
error: LF

LF is a Line feed (new line \u000A)
tab is a tabulation (\u0009)

Remarks

Timeout is 10 seconds