Difference between revisions of "Connect"
(→Parameters) |
(→connect) |
||
(One intermediate revision by the same user not shown) | |||
Line 107: | Line 107: | ||
data["key"] = "example@key"; | data["key"] = "example@key"; | ||
data["cmd"] = 22; | data["cmd"] = 22; | ||
− | |||
ar xhr = new XMLHttpRequest(); | ar 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/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"/> | ||
Cmd:<input type="text" id="cmd" name="cmd" value="22"/> | Cmd:<input type="text" id="cmd" name="cmd" value="22"/> | ||
− | |||
<input type="submit" value="Submit"> | <input type="submit" value="Submit"> | ||
</form> | </form> | ||
==== get ==== | ==== get ==== | ||
− | + | anywhere.wordfast.com/wfa/api?key=example@key&cmd=22 | |
=== Response example === | === Response example === | ||
Line 165: | Line 163: | ||
Timeout is 30 seconds | Timeout is 30 seconds | ||
<br>TM types are WFA (hosted by Wordfast TM server having only private TUs), SPE (A specific TM hosted by someone else and may contain public and private TUs), VLTM (Very Large TM Server hosted by Wordfast having a limited number of TMs containing only public TUs) | <br>TM types are WFA (hosted by Wordfast TM server having only private TUs), SPE (A specific TM hosted by someone else and may contain public and private TUs), VLTM (Very Large TM Server hosted by Wordfast having a limited number of TMs containing only public TUs) | ||
− | <br>Glossary types are WFA, SPE | + | <br>Glossary types are WFA, SPE, IATE. |
Latest revision as of 09:37, 17 January 2024
Contents
connect
connect (string key, int cmd)
Connect to the TMs and glossaries.
Parameters
key | string | a valid API Key, generated by making a share at www.freetm.com |
cmd | int | command number is 22 |
Returned value
connections | array | connection details
|
Request example
json post with javascript
var data = {}; data["key"] = "example@key"; data["cmd"] = 22; ar 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/wfa/api" method="post"> Key:<input type="text" id="key" name="key" value="example@key"/> Cmd:<input type="text" id="cmd" name="cmd" value="22"/> <input type="submit" value="Submit"> </form>
get
anywhere.wordfast.com/wfa/api?key=example@key&cmd=22
Response example
json
{ "connections": [{ "id": 1 ,"type": "WFA" ,"wkgid": "#TC4=XNTd6" ,"userId": "g7PWd4" ,"tms": [{ "tmid":1, "srcLang":"DE-DE", "trglang":"EN-US", "name":"cat", "readonly":"false" } ,{...} ] ,"glos": [{ "gloid":1, "srcLang":"DE-DE", "trglang":"EN-US", "name":"cat", "readonly":"false" } ,{...} ] ,"error": "" } ,{...} ] }
without white space (new line, carriage return or tabulation).
text
id:1 LF type:WFA LF wkgid:#TC4=XNTd6 LF userId: g7PWd4 LF tmid:1 tab srcLang:DE-DE tab trglang:EN-US tab name:cat tab readonly:false LF gloid:2 tab srcLang:DE-DE tab trglang:EN-US tab name:cat tab readonly:false LF error: LF
LF is a Line feed (new line \u000A) tab is a tabulation (\u0009)
Remarks
Timeout is 30 seconds
TM types are WFA (hosted by Wordfast TM server having only private TUs), SPE (A specific TM hosted by someone else and may contain public and private TUs), VLTM (Very Large TM Server hosted by Wordfast having a limited number of TMs containing only public TUs)
Glossary types are WFA, SPE, IATE.