AddTerm
Contents
addTerm
addTerm (string key, int cmd, string source, string target, string comment, string F1, string F2, string F3, boolean doNotAddDuplicate)
Add a term to the available glossaries in write mode. The number of glossaries in write mode is currently limited to one.
Parameters
key string | string | a valid API Key, generated by making a share at www.freetm.com |
cmd | int | command number is 52 |
source | string | source segment |
target | string | target segment |
comment | string | optional - additional information on 3rd field |
F1 | string | optional - additional information on 4th field |
F2 | string | optional - additional information on 5th field |
F3 | string | optional - additional information on 6th field |
doNotAddDuplicate | boolean | optional - Do not add an existing term. Default value is false. |
Returned value
glos
array | Add result detail for each glossary
|
Request example
json post with javascript
var data = {}; data["key"] = "example@key"; data["cmd"] = 52; data["source"] = "fox"; data["target"] = "renard"; data["comment"] = ""; data["F1"] = ""; data["F2"] = ""; data["F3"] = ""; data["doNotAddDuplicate"] = false; 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./wfa/api" method="post"> Key: <input type="text" id="key" name="key" value="example@key"/> Command: <input type="text" id="cmd" name="cmd" value="52"/> Source: <textarea id="source" name="source" style="width: 500px; height: 60px;"/textarea> Target: <textarea id="target" name="target" style="width: 500px; height: 60px;"/textarea> Comment (optional): <input type="text" id="comment" name="comment" value="" class="optional"/> F1 (optional): <input type="text" id="F1" name="F1" value="" class="optional"/> F2 (optional): <input type="text" id="F2" name="F2" value="" class="optional"/> F3 (optional): <input type="text" id="F3" name="F3" value="" class="optional"/> doNotAddDuplicate(optional): <input type="text" id="doNotAddDuplicate" name="doNotAddDuplicate" value="0" class="optional"/> <input type="submit" value="Submit"> </form>
get
www.freetm.com/wfa/api?key=example@key&cmd=52&source=xxx&target=yyy&doNotAddDuplicate=0
Response example
json
{ "glos": [{ "gloid":1 ,"success": true ,"error": "" } ,{ "gloid":2 ,"success": false ,"error": "glossary is not opened" } ,{...} ] }
without white space (new line, carriage return or tabulation).
text
1 : trueLF 2 : glossary is not openedLF
LF is a Line feed (new line \u000A)
Remarks
When the command is used with the "do not duplicate" option or within a batch, the priority is automatically decreased.