Difference between revisions of "CountTerms"

From Wordfast Wiki
Jump to: navigation, search
(Returned value)
 
(No difference)

Latest revision as of 15:44, 20 March 2015

Return to command list

countTerms

countTerms (string key, int cmd)

Count the number of entries of all the glossaries.

Parameters

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

Returned value

connections array Detail of Terms count for each connection
id int connection ID
glos array Term counts
gloid int glossary 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"] = 502;
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="502"/>	
   <input type="submit" value="Submit">				
</form>

get

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

Response example

json

{

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

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

text

id:1 LF
gloid: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