Request & Response
The core configuration of Machine Translation Request
Variables
$ID
$SOURCE_TEXT
$ORIGINAL_TEXT
$TRANSLATED_TEXT
$SOURCE_LANG
$TARGET_LANG
You can use schema variables in the configuration with syntax $SCHEMA_NAME
For example:
Parameters
method:
string
web_scraping
http_get
http_post
web_llm
url: string
encodeURI:
string (optional)
Escapes characters by UTF-8 code units, with each octet encoded in the format%XX
, left-padded with 0 if necessary. Because lone surrogates in UTF-16 do not encode any valid Unicode character. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIencodeURIComponent:
string (optional)
Uses the same encoding algorithm as described in encodeURI. It escapes all characters except:A–Z a–z 0–9 - _ . ! ~ * ' ( )
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponentencodeURIExtra:
string (optional)
Additional function to replace URI with regexp string. For example:"["%2F", "g", "\\%2F"]"
initialUrl:
string (only for web scraping method / optional)
userAgent:
string (only for web scraping method / optional)
querySelector:
string (only for web scraping method)
Return the first Element within the HTML that matches the specified selector, or group of selectors. https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorquerySelectorAll:
string (only for web scraping method / optional)
return a static (not live) NodeList representing a list of the HTML elements that match the specified group of selectors. https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAllqueryProperty:
string (only for web scraping method)
value - property of the
HTMLDataElement
https://developer.mozilla.org/en-US/docs/Web/API/HTMLDataElement/valueinnerText - property of the
HTMLElement
https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/innerTextinnerHTML - property of the
HTMLElement
https://developer.mozilla.org/en-US/docs/Web/API/Element/innerHTMLtextContent - property of the
Node
https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent
body:
object (only for http method)
options:
object (only for http method / optional)
headers - set request headers
X-Custom-Header:
string
Authorization:
string
Content-Type:
string
responseType:
string (only for http method)
string - set response type as string
json - set response type as json
responseQuery:
string (only for http method)
JSON Response from HTTP Request
You can parse the JSON Response with ResponseQuery
The responseQuery
is only used for http_get
and http_post
methods with the response type as JSON
A JSON object is an associative array. The location path syntax to navigate into an arbitrarily deeply nested structure of JSON objects comprises the field names separated by dot '.' delimiters.
For example the following JSON Response
text
Hello 1
words[0].text
Hello 2
lines.sub.text
Hello 5
Examples
1. Web Scraping Method - Object Structure
method:
string
encodeURI:
boolean
encodeURIComponent:
boolean
encodeURIExtra:
string
url:
string
initialUrl:
string
querySelector:
string
querySelectorAll:
string
queryProperty:
string
2. HTTP GET Method- Object Structure
method:
string
encodeURI:
boolean
encodeURIComponent:
boolean
encodeURIExtra:
string
url:
string
options:
object
responseType:
string
responseQuery:
string
3. HTTP POST Method - Object Structure
method:
string
encodeURI:
boolean
encodeURIComponent:
boolean
encodeURIExtra:
string
url:
string
body:
object
options:
object
headers:
object
X-Custom-Header:
string
Authorization:
string
Content-Type:
string
responseType:
string
responseQuery:
string
Last updated