SearchTerm

From Wordfast Wiki
Jump to: navigation, search

Return to command list

searchTerm

searchTerm (string key, int cmd, string query)

Search terms from a segment or search a simple term or phrase in the glossary and return the list of found terms.

Parameters

key string a valid API Key, generated by making a share at www.freetm.com
cmd int command number is 51
query string term, phrase or source sentence to search in the glossary

Returned value

terms array Term details
gloId int glossary ID
termId string term ID - mandatory for deleteTerm command.
source string source term
target string target term
comment string first attribute
F1 string second attribute
F2 string third attribute
F3 string fourth attribute

Request example

json post with javascript

var data = {};
data["key"] = "example@key";
data["cmd"] = 51;
data["query"] = "The brown fox is jumping over the lazy dog";
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">
   Key: <input type="text" id="key" name="key" value="example@key"/>
   Command: <input type="text" id="cmd" name="cmd" value="51"/>
   Query: <textarea id="query" name="query" style="width: 500px; height: 60px;"></textarea>
   <input type="submit" value="Submit">
</form>

get

anywhere.wordfast.com/wfa/api?key=example@key&cmd=51&query=the%20brown%20fox%20is%20jumping%20over%20the%lazy%dog

Response example

json

{ "terms": [{
               "gloId": 1
	        ,"termId": "88474b70-5f70-11e4-aad0-5c539f6f39a2"	 		 
		,"source": "fox"
		,"target": "renard"
		,"comment": ""
		,"F1": ""
		,"F2": ""
		,"F3": ""
	      }
	      ,{...}
  ]
}

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

text

1 tab 88474b70-5f70-11e4-aad0-5c539f6f39a2 tab fox tab renard tab tab tab tab LF

LF is Line Feed (\u000A) tab is a tabulation (\u0009)

Remarks