Difference between revisions of "CountTus"
(→countTus) |
|||
| Line 60: | Line 60: | ||
data["cmd"] = 501; | data["cmd"] = 501; | ||
var xhr = new XMLHttpRequest(); | var xhr = new XMLHttpRequest(); | ||
| − | xhr.open("POST", " | + | xhr.open("POST", "anywhere.wordfast.com/wfa/api", true); |
xhr.setRequestHeader("Content-Type", "application/json;charset=UTF-8"); | xhr.setRequestHeader("Content-Type", "application/json;charset=UTF-8"); | ||
xhr.send(JSON.stringify(data)); | xhr.send(JSON.stringify(data)); | ||
==== post ==== | ==== post ==== | ||
| − | <form action=" | + | <form action="anywhere.wordfast.com/wfa/api" method="post"> |
<input type="text" id="key" name="key" value="example@key"/> | <input type="text" id="key" name="key" value="example@key"/> | ||
<input type="text" id="cmd" name="cmd" value="501"/> | <input type="text" id="cmd" name="cmd" value="501"/> | ||
| Line 72: | Line 72: | ||
==== get ==== | ==== get ==== | ||
| − | + | anywhere.wordfast.com/wfa/api?key=example@key&cmd=501 | |
=== Response example === | === Response example === | ||
Latest revision as of 10:02, 17 January 2024
Contents
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
|
Request example
json post with javascript
var data = {};
data["key"] = "example@key";
data["cmd"] = 501;
var xhr = new XMLHttpRequest();
xhr.open("POST", "anywhere.wordfast.com/wfa/api", true);
xhr.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
xhr.send(JSON.stringify(data));
post
<form action="anywhere.wordfast.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
anywhere.wordfast.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