Pricing 
API Pricing

Try For Free Now

Dark

Light

SPECIALIZED FIELDS
Specialized fields
Obtain the list of specialized fields.
With specifying the field, translation would be more precise.
Endpoint
Request details
GET
https://translate.rozetta-api.io/api/v1/field/list
Header
Header
Description
accessKey, nonce, signature
Please refer to the authentication section.
Parameter
Parameter
Require
Description
engine
O
Text-to-text translation engine name. Valid values are "t4oo".
language
O
The language of field name. Valid values are "ja" (Japanese) and "en" (English).
level
Please specify 1 for fields up to layer1, specify 2 for fields up to layer2. When you don't specify level, it returns all specialized fields. Only 「t4oo」 engine supports layered fields.
Request Sample
curl -H "nonce: Your Nonce" -H "accessKey: Your Access Key" -H "signature: Your Signature" https://translate.rozetta-api.info/api/v1/field/list?engine=t4oo&language=ja
Response
Key
Description
status
For successfully getting of an entry, this field will be "success". For unsuccessful requests, this field will be "failure".
fields
id: specialized field ID name: specialized field name parent: specialized field ID which belong to parent ID (*When you don’t specify level, some specialized fields have no parent ID.)
Response Sample
{
  "status": "success",
  "data": {
    "fields": [
      {
        "id": "1",
        "name": "全体"
      },
      {
        "id": "414",
        "name": "一般・趣味・娯楽"
      },
      {
        "id": "454",
        "name": "人文・社会"
      },
      {
        "id": "475",
        "name": "医薬・化学・環境"
      },
      {
        "id": "1538",
        "name": "IT・機械・電気電子"
      },
      {
        "id": "2570",
        "name": "ビジネス専門"
      },
      {
        "id": "3",
        "name": "HP・会社案内・広報・PR"
      },
      {
        "id": "12",
        "name": "商業・貿易"
      }
    ]
  }
}

api/v1/field/list
Request for a list of specialized fields supported by T4OO.
const https = require('https');
const queryString = require('querystring');

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

const serverConfig = {
 protocol: 'https:',
 hostname: 'translate.rozetta-api.info',
 port: 443
};
const authConfig = {
 accessKey: 'YOUR_ACCESS_KEY',
 secretKey: 'YOUR_SECRET_KEY',
 nonce: new Date().getTime().toString()
};
const listConfig = {
 engine: 't4oo',
 language: 'ja'
};

const getTextResult = async (serverConfig, authConfig, listConfig) => {
 const queryParameters = queryString.stringify({
   engine: listConfig.engine,
   language: listConfig.language
 })
 const path = `/api/v1/field/list?${queryParameters}`;
 const signature = authUtils.generateSignature(
   path,
   authConfig.secretKey,
   authConfig.nonce
 );
 const requestOptions = {
   protocol: serverConfig.protocol,
   host: serverConfig.hostname,
   port: serverConfig.port,
   method: 'GET',
   path,
   headers: {
     accessKey: authConfig.accessKey,
     signature,
     nonce: authConfig.nonce
   }
 };
 
 return new Promise((resolve, reject) => {
   const request = https.request(requestOptions, (response) => {
     response.setEncoding('utf8');
     let data = '';
     response.on('data', (chunk) => {
       data += chunk;
     });
     response.on('end', () => {
       resolve(data);
     });
   });
   request.on('error', (error) => {
     reject(error);
   });
   request.end();
 });
};

const main = async () => {
 try {
   const response = await getTextResult(
     serverConfig,
     authConfig,
     listConfig
   );
   console.log('Server response:');
   console.log(response);
 } 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.

^