Difference between revisions of "SearchTerm"
(→searchTerm) |
(→searchTerm) |
||
Line 68: | Line 68: | ||
data["query"] = "The brown fox is jumping over the lazy dog"; | data["query"] = "The brown fox is jumping over the lazy dog"; | ||
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"> |
Key: <input type="text" id="key" name="key" value="example@key"/> | Key: <input type="text" id="key" name="key" value="example@key"/> | ||
Command: <input type="text" id="cmd" name="cmd" value="51"/> | Command: <input type="text" id="cmd" name="cmd" value="51"/> | ||
Line 81: | Line 81: | ||
==== get ==== | ==== get ==== | ||
− | + | anywhere.wordfast.com/wfa/api?key=example@key&cmd=51&query=the%20brown%20fox%20is%20jumping%20over%20the%lazy%dog | |
=== Response example === | === Response example === |
Latest revision as of 09:54, 17 January 2024
Contents
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
|
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)