Pricing 
API Pricing

Try For Free Now

Dark

Light

FILE TRANSLATION
File Translation Result
Get the result of file translation.
File Translation can only be processed by T-4OO or T-3MT engine.
Endpoint
Request details
GET
https://translate.rozetta-api.io/api/v1/translate-result/<translateId>
Path parameter
Path parameter
Description
translateId
The translaction task ID returned from the API after submitting the translation task.
Header
Header
Description
accessKey, nonce, signature
Please refer to the authentication section.
Request Sample
curl -H "nonce: Your Nonce" -H "accessKey: Your Access Key" -H "signature: Your Signature" https://translate.rozetta-api.info/api/v1/translate-result/8c76e418-9842-455b-aac1-5be28e8e4e94
Response
Key
Description
status
For successful request, success will be specified for this field, otherwise failure will be specified. ※Even only one paragraph is failed to translate, the entire request will be failed.
data
Object of result. You can use "translateItemId" to download the translated files. "lang": the language of the translated text. "wordCount": how many words(T-4OO) or characters(T-3MT) you used in the translation. "detectedLang": the language detected for the original file. “done”: the file translation is completed or not. "true" means completed while "false" means not. "originalName": the original name of the file you uploaded. With "downloaded" you can check the files are downloaded or not. true for downloaded, false for not downloaded yet. With "error" you can check if there's any error occured. true for there's some error. false for normal. With "errorCode" you can check the error code. With "errorMessage" you can check the error message. "id" is numeric id. With "t4ooAuthFailed" is only showed when user is connected to T-4OO account and occured some error when translating. true for there's some error.
Response Sample
{
  "status": "success",
  "data": {
    "translateId": "8c76e418-9842-455b-aac1-5be28e8e4e94",
    "done": false,
    "langs": [
      "zh-CN",
      "ja"
    ],
    "fieldId": 1,
    "createdAt": {},
    "items": [
      {
        "translateItemId": "8c76e418-9842-455b-aac1-5be28e8e4e94",
        "lang": "ja",
        "wordCount": 1000,
        "detectedLang": "zh-CN",
        "done": false,
        "originalName": "test.pdf",
        "downloaded":false,
        "error":false,
        "errorCode":null,
        "errorMessage":null,
        "id":5507
      }
    ]
  }
}

api/v1/translate-result/<translateId>
Get translate result with request ID.
const superagent = require('superagent');
const config = require('./config');

const authUtils = require('./utils/auth-utils');

const translateId = 'your translateId';
const url = `/api/v1/translate-result/${translateId}`;

const sendRequest = (serverConfig, accessKey, secretKey) => {
  const nonce = new Date().getTime().toString();
  const signature = authUtils.generateSignature(
    url,
    secretKey,
    nonce,
  );

  superagent.get(`${serverConfig.protocol}//${serverConfig.hostname}:${serverConfig.port}${url}`)
    .set({
      accessKey,
      signature,
      nonce,
    }).end((req, resp) => {
      console.log(resp.text);
    });
};

const main = async () => {
  try {
    await sendRequest(
      config.serverConfig,
      config.authConfig.accessKey,
      config.authConfig.secretKey,
    );
  } catch (error) {
    console.error(error);
  }
};

main();
About the authentication, please refer to the authentication section.
You can get a full version of sample codes here
©️ 2019 Rozetta API  ・  Powered by Rozetta

Rozetta Corp.

^