{"id":2011,"date":"2022-07-23T09:51:39","date_gmt":"2022-07-23T00:51:39","guid":{"rendered":"https:\/\/dreamsavior.net\/docs\/yojet\/api-reference\/"},"modified":"2023-01-25T13:38:40","modified_gmt":"2023-01-25T04:38:40","slug":"api-reference","status":"publish","type":"docs","link":"https:\/\/dreamsavior.net\/docs\/yojet\/api-reference\/","title":{"rendered":"API Reference"},"content":{"rendered":"\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">YOJET Flavor<\/h2>\n\n\n\n<p><\/p>\n\n\n\n<p><strong>URL<\/strong> : http:\/\/host:port\/translate<\/p>\n\n\n\n<p><strong>HTTP Method<\/strong>: POST<\/p>\n\n\n\n<p><strong>Headers <\/strong>: Content-Type: application\/json<\/p>\n\n\n\n<p><strong>Body<\/strong>: JSON formatted object with the following parameters:<\/p>\n\n\n\n<figure class=\"wp-block-table is-style-stripes\"><table><tbody><tr><td>Parameter<\/td><td>Information<\/td><td>Sample<\/td><\/tr><tr><td>t<\/td><td>A text or array of texts<\/td><td>A single text:<br><code>t: `YOJET\u6700\u9ad8\uff01`<\/code><br>Array of texts:<br><code>t: [`\u3053\u3093\u306b\u3061\u306f`, `\u3088\u308d\u3057\u304f\u304a\u9858\u3044\u3057\u307e\u3059\u3002`]<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Example 1<\/h3>\n\n\n\n<p>The example below demonstrates in Javascript how to translate a text to a YOJET server located at <code>127.0.0.1<\/code> with port <code>14366<\/code><\/p>\n\n\n\n<pre title=\"JavaScript\" class=\"wp-block-code\"><code lang=\"javascript\" class=\"language-javascript line-numbers\">var req = await fetch(`http:\/\/127.0.0.1:14366\/translate`, {\n\tmethod : \"POST\",\n\tbody : JSON.stringify({t: [`\u3053\u3093\u306b\u3061\u306f`, `\u3088\u308d\u3057\u304f\u304a\u9858\u3044\u3057\u307e\u3059\u3002`]}),\n\theaders : {'Content-Type': 'application\/json'}\n})\nawait req.json();<\/code><\/pre>\n\n\n\n<p>The result is:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"json\" class=\"language-json\">[\n  \"Hello. Hello.\",\n  \"I look forward to working with you.\"\n]<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Example 2<\/h3>\n\n\n\n<p>The example below demonstrates in Javascript how to translate an array of texts to a YOJET server located at <code>127.0.0.1<\/code> with port <code>14366<\/code><\/p>\n\n\n\n<pre title=\"JavaScript\" class=\"wp-block-code\"><code lang=\"javascript\" class=\"language-javascript line-numbers\">var req = await fetch(`http:\/\/127.0.0.1:14366\/translate`, {\n\tmethod : \"POST\",\n\tbody : JSON.stringify({t: `YOJET\u6700\u9ad8\uff01`}),\n\theaders : {'Content-Type': 'application\/json'}\n})\nawait req.json();<\/code><\/pre>\n\n\n\n<p>The result is:<\/p>\n\n\n\n<pre title=\"Result of execution\" class=\"wp-block-code\"><code lang=\"javascript\" class=\"language-javascript\">YoJET is the best!<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Sugoi Offline Translator flavor<\/h2>\n\n\n\n<p>YOJET can also handle requests in the Sugoi Offline Translator format<\/p>\n\n\n\n<p><strong>URL<\/strong> : <a href=\"about:blank\">http:\/\/host:port\/<\/a><\/p>\n\n\n\n<p><strong>HTTP Method<\/strong>: POST<\/p>\n\n\n\n<p><strong>Headers <\/strong>: Content-Type: application\/json<\/p>\n\n\n\n<p><strong>Body<\/strong>: JSON formatted object with the following parameters:<\/p>\n\n\n\n<figure class=\"wp-block-table is-style-stripes\"><table><tbody><tr><td>Parameter<\/td><td>Information<\/td><td>Sample<\/td><\/tr><tr><td>content<\/td><td>The content of the information. <br>Can be a string or array of strings.<\/td><td>A single text:<br><code>t: `YOJET\u6700\u9ad8\uff01`<\/code><br><br>Array of texts:<br><code>t: [`\u3053\u3093\u306b\u3061\u306f`, `\u3088\u308d\u3057\u304f\u304a\u9858\u3044\u3057\u307e\u3059\u3002`]<\/code><br><\/td><\/tr><tr><td>message<\/td><td>The command to be executed<br>Accepted value is one of the following:<br><strong><code>translate sentences<\/code><\/strong><br>To translate text<br><br><strong><code>batch<\/code><\/strong><br>To batch translate bundled texts in a file<br><\/td><td><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Example 1<\/h3>\n\n\n\n<pre title=\"JavaScript\" class=\"wp-block-code\"><code lang=\"javascript\" class=\"language-javascript\">var req = await fetch(`http:\/\/127.0.0.1:14366\/`, {\n\tmethod : \"POST\",\n\tbody : JSON.stringify({\n\t\t\tmessage: \"translate sentences\",\n\t\t\tcontent: [`\u3053\u3093\u306b\u3061\u306f`, `\u3088\u308d\u3057\u304f\u304a\u9858\u3044\u3057\u307e\u3059\u3002`],\n\t\t}),\n\theaders : {'Content-Type': 'application\/json'}\n})\nawait req.json();<\/code><\/pre>\n\n\n\n<p>The result is:<\/p>\n\n\n\n<pre title=\"Result of execution\" class=\"wp-block-code\"><code lang=\"json\" class=\"language-json\">[\n  \"Hello. Hello.\",\n  \"I look forward to working with you.\"\n]<\/code><\/pre>\n","protected":false},"featured_media":0,"parent":2009,"menu_order":1,"comment_status":"open","ping_status":"closed","template":"","doc_tag":[],"class_list":["post-2011","docs","type-docs","status-publish","hentry"],"acf":{"post_info":""},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>API Reference &#8211; Dreamsavior<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/dreamsavior.net\/docs\/yojet\/api-reference\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"API Reference &#8211; Dreamsavior\" \/>\n<meta property=\"og:description\" content=\"YOJET Flavor URL : http:\/\/host:port\/translate HTTP Method: POST Headers : Content-Type: application\/json Body: JSON formatted object with the following parameters:&hellip;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/dreamsavior.net\/docs\/yojet\/api-reference\/\" \/>\n<meta property=\"og:site_name\" content=\"Dreamsavior\" \/>\n<meta property=\"article:modified_time\" content=\"2023-01-25T04:38:40+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/dreamsavior.net\/docs\/yojet\/api-reference\/\",\"url\":\"https:\/\/dreamsavior.net\/docs\/yojet\/api-reference\/\",\"name\":\"API Reference &#8211; Dreamsavior\",\"isPartOf\":{\"@id\":\"https:\/\/dreamsavior.net\/#website\"},\"datePublished\":\"2022-07-23T00:51:39+00:00\",\"dateModified\":\"2023-01-25T04:38:40+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/dreamsavior.net\/docs\/yojet\/api-reference\/#breadcrumb\"},\"inLanguage\":\"en\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/dreamsavior.net\/docs\/yojet\/api-reference\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/dreamsavior.net\/docs\/yojet\/api-reference\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/dreamsavior.net\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"YOJET\",\"item\":\"https:\/\/dreamsavior.net\/docs\/yojet\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"API Reference\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/dreamsavior.net\/#website\",\"url\":\"https:\/\/dreamsavior.net\/\",\"name\":\"Dreamsavior\",\"description\":\"Saving dreams since 2006\",\"publisher\":{\"@id\":\"https:\/\/dreamsavior.net\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/dreamsavior.net\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/dreamsavior.net\/#organization\",\"name\":\"Dreamsavior\",\"url\":\"https:\/\/dreamsavior.net\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en\",\"@id\":\"https:\/\/dreamsavior.net\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/dreamsavior.net\/wp-content\/uploads\/2019\/06\/DV-patreon.png\",\"contentUrl\":\"https:\/\/dreamsavior.net\/wp-content\/uploads\/2019\/06\/DV-patreon.png\",\"width\":600,\"height\":600,\"caption\":\"Dreamsavior\"},\"image\":{\"@id\":\"https:\/\/dreamsavior.net\/#\/schema\/logo\/image\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"API Reference &#8211; Dreamsavior","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/dreamsavior.net\/docs\/yojet\/api-reference\/","og_locale":"en_US","og_type":"article","og_title":"API Reference &#8211; Dreamsavior","og_description":"YOJET Flavor URL : http:\/\/host:port\/translate HTTP Method: POST Headers : Content-Type: application\/json Body: JSON formatted object with the following parameters:&hellip;","og_url":"https:\/\/dreamsavior.net\/docs\/yojet\/api-reference\/","og_site_name":"Dreamsavior","article_modified_time":"2023-01-25T04:38:40+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/dreamsavior.net\/docs\/yojet\/api-reference\/","url":"https:\/\/dreamsavior.net\/docs\/yojet\/api-reference\/","name":"API Reference &#8211; Dreamsavior","isPartOf":{"@id":"https:\/\/dreamsavior.net\/#website"},"datePublished":"2022-07-23T00:51:39+00:00","dateModified":"2023-01-25T04:38:40+00:00","breadcrumb":{"@id":"https:\/\/dreamsavior.net\/docs\/yojet\/api-reference\/#breadcrumb"},"inLanguage":"en","potentialAction":[{"@type":"ReadAction","target":["https:\/\/dreamsavior.net\/docs\/yojet\/api-reference\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/dreamsavior.net\/docs\/yojet\/api-reference\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/dreamsavior.net\/"},{"@type":"ListItem","position":2,"name":"YOJET","item":"https:\/\/dreamsavior.net\/docs\/yojet\/"},{"@type":"ListItem","position":3,"name":"API Reference"}]},{"@type":"WebSite","@id":"https:\/\/dreamsavior.net\/#website","url":"https:\/\/dreamsavior.net\/","name":"Dreamsavior","description":"Saving dreams since 2006","publisher":{"@id":"https:\/\/dreamsavior.net\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/dreamsavior.net\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en"},{"@type":"Organization","@id":"https:\/\/dreamsavior.net\/#organization","name":"Dreamsavior","url":"https:\/\/dreamsavior.net\/","logo":{"@type":"ImageObject","inLanguage":"en","@id":"https:\/\/dreamsavior.net\/#\/schema\/logo\/image\/","url":"https:\/\/dreamsavior.net\/wp-content\/uploads\/2019\/06\/DV-patreon.png","contentUrl":"https:\/\/dreamsavior.net\/wp-content\/uploads\/2019\/06\/DV-patreon.png","width":600,"height":600,"caption":"Dreamsavior"},"image":{"@id":"https:\/\/dreamsavior.net\/#\/schema\/logo\/image\/"}}]}},"comment_count":0,"_links":{"self":[{"href":"https:\/\/dreamsavior.net\/wp-json\/wp\/v2\/docs\/2011","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dreamsavior.net\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/dreamsavior.net\/wp-json\/wp\/v2\/types\/docs"}],"replies":[{"embeddable":true,"href":"https:\/\/dreamsavior.net\/wp-json\/wp\/v2\/comments?post=2011"}],"version-history":[{"count":9,"href":"https:\/\/dreamsavior.net\/wp-json\/wp\/v2\/docs\/2011\/revisions"}],"predecessor-version":[{"id":2310,"href":"https:\/\/dreamsavior.net\/wp-json\/wp\/v2\/docs\/2011\/revisions\/2310"}],"up":[{"embeddable":true,"href":"https:\/\/dreamsavior.net\/wp-json\/wp\/v2\/docs\/2009"}],"prev":[{"title":"Getting Started with YOJET","link":"https:\/\/dreamsavior.net\/docs\/yojet\/getting-started-with-yojet\/","href":"https:\/\/dreamsavior.net\/wp-json\/wp\/v2\/docs\/2010"}],"wp:attachment":[{"href":"https:\/\/dreamsavior.net\/wp-json\/wp\/v2\/media?parent=2011"}],"wp:term":[{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/dreamsavior.net\/wp-json\/wp\/v2\/doc_tag?post=2011"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}