Difference between revisions of "Connect"

From Wordfast Wiki
Jump to: navigation, search
(text)
 
(connect)
 
(2 intermediate revisions by the same user not shown)
Line 17: Line 17:
 
|int
 
|int
 
|command number is 22
 
|command number is 22
 
|-
 
|joinTmGloInOneConnection
 
|boolean
 
|'''optional''' - Will create one connection for a standard Wordfast Anywhere TM and glossary having the same languages and variants - This allow to use only one command, searchSegment, to make the searches in the TM and in the glossary - Default value is false
 
  
 
|}
 
|}
Line 112: Line 107:
 
  data["key"] = "example@key";
 
  data["key"] = "example@key";
 
  data["cmd"] = 22;
 
  data["cmd"] = 22;
data["joinTmGloInOneConnection"] = false; //optional
 
 
  ar xhr = new XMLHttpRequest();
 
  ar xhr = new XMLHttpRequest();
  xhr.open("POST", "www.freetm.com/wfa/api", true);
+
  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="www.freetm/wfa/api" method="post">
+
  <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"/>
    Join TmGlo Connections (optional)<input type="checkbox" id="joinTmGloInOneConnection"  name="joinTmGloInOneConnection"/>
 
 
     <input type="submit" value="Submit">
 
     <input type="submit" value="Submit">
 
  </form>
 
  </form>
  
 
==== get ====
 
==== get ====
www.freetm.com/wfa/api?key=example@key&cmd=22
+
anywhere.wordfast.com/wfa/api?key=example@key&cmd=22
  
 
=== Response example ===  
 
=== Response example ===  
Line 170: 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 and TMGR (A specific type imported as a read-only WFA type)
+
<br>Glossary types are WFA, SPE, IATE.

Latest revision as of 09:37, 17 January 2024

Return to command list

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
id int connection ID
type string connection type
wkgid string workgroup ID
userId string user ID
tms array TM detail
tmid int TM ID
srcLang string source language
trgLang string target language
name string assigned or symbolic name
readonly boolean read/write status
glos array glossary detail
gloid int glossary ID
srcLang string source language
trgLang string target language
name string assigned or symbolic name
readonly boolean read/write status
error string error during connection

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.