收费标准 
API价格

马上免费试用

暗色

亮色

LANGUAGES
语音识别语言列表
查阅语音识别API所支持的所有语言。
Endpoint
Request details
GET
https://translate.rozetta-api.io/api/v1/stt-languages
Header
Header
Description
accessKey, nonce, signature
请参考「加密签名」章节
Request例文
curl -H "nonce: Your Nonce" -H "accessKey: Your Access Key" -H "signature: Your Signature" https://translate.rozetta-api.io/api/v1/stt-languages
Response
Key
Description
status
成功取得語言列表后,此栏的值将会是success,否则会是failure。
languages
所有支持语言的列表,当中包含语言代码、名称以及描述。 除zh-CN、zh-TW、zh-HK外,语言代码照ISO 639-1代码规定使用。
Response例文
{
  "status": "success",
  "data": {
      "languages": [
          {
              "language": "Afrikaans",
              "abbreviation": "af",
              "description": "Afrikaans"
          },
          {
              "language": "Amharic",
              "abbreviation": "am",
              "description": "Amharic"
          },
          {
              "language": "Arabic",
              "abbreviation": "ar",
              "description": "Arabic"
          },
          ...
      ]
  }
}

api/v1/stt-languages
展开语言的列表。
const https = require('https');

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

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

const getLanguagesList = (serverConfig, authConfig) => {
 const path = '/api/v1/stt-languages';
 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 getLanguagesList(
     serverConfig,
     authConfig,
   );
   console.log('Server response:');
   console.log(response);
 } catch (error) {
   console.error(error);
 }
};

main();
关于认证方法,请参考「加密签名」章节。
关于各语言完整的示例代码,请参考这裡
©️ 2019 Rozetta API  ・  Powered by Rozetta

Rozetta股份有限公司

^