API Reference

⌘K
  1. Home
  2. YOJET
  3. API Reference

API Reference

YOJET Flavor

URL : http://host:port/translate

HTTP Method: POST

Headers : Content-Type: application/json

Body: JSON formatted object with the following parameters:

ParameterInformationSample
tA text or array of textsA single text:
t: `YOJET最高!`
Array of texts:
t: [`こんにちは`, `よろしくお願いします。`]

Example 1

The example below demonstrates in Javascript how to translate a text to a YOJET server located at 127.0.0.1 with port 14366

var req = await fetch(`http://127.0.0.1:14366/translate`, {
	method : "POST",
	body : JSON.stringify({t: [`こんにちは`, `よろしくお願いします。`]}),
	headers : {'Content-Type': 'application/json'}
})
await req.json();

The result is:

[
  "Hello. Hello.",
  "I look forward to working with you."
]

Example 2

The example below demonstrates in Javascript how to translate an array of texts to a YOJET server located at 127.0.0.1 with port 14366

var req = await fetch(`http://127.0.0.1:14366/translate`, {
	method : "POST",
	body : JSON.stringify({t: `YOJET最高!`}),
	headers : {'Content-Type': 'application/json'}
})
await req.json();

The result is:

YoJET is the best!

Sugoi Offline Translator flavor

YOJET can also handle requests in the Sugoi Offline Translator format

URL : http://host:port/

HTTP Method: POST

Headers : Content-Type: application/json

Body: JSON formatted object with the following parameters:

ParameterInformationSample
contentThe content of the information.
Can be a string or array of strings.
A single text:
t: `YOJET最高!`

Array of texts:
t: [`こんにちは`, `よろしくお願いします。`]
messageThe command to be executed
Accepted value is one of the following:
translate sentences
To translate text

batch
To batch translate bundled texts in a file

Example 1

var req = await fetch(`http://127.0.0.1:14366/`, {
	method : "POST",
	body : JSON.stringify({
			message: "translate sentences",
			content: [`こんにちは`, `よろしくお願いします。`],
		}),
	headers : {'Content-Type': 'application/json'}
})
await req.json();

The result is:

[
  "Hello. Hello.",
  "I look forward to working with you."
]
Was this article helpful to you? No Yes 1

How can we help?