文本翻译
POST
/im/v2/translations
请求参数
Header 参数
AppKey
string
必需
默认值:
{{AppKey}}
X-custom-traceid
string
可选
默认值:
{% mock 'uuid' %}
Nonce
string
必需
默认值:
{{Nonce}}
CurTime
string
必需
默认值:
{{CurTime}}
CheckSum
string
必需
默认值:
{{CheckSum}}
Body 参数application/json
translator_config
object (TranslatorConfig)
可选
strict
boolean
可选
默认值:
true
operator_account_id
string
可选
source_text
string
可选
source_language
string
可选
target_language
string
可选
示例
{
"translator_config": {
"strict": true
},
"operator_account_id": "string",
"source_text": "string",
"source_language": "string",
"target_language": "string"
}
示例代码
Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://open.yunxinapi.com/im/v2/translations' \
--header 'AppKey;' \
--header 'X-custom-traceid: {% mock '\''uuid'\'' %}' \
--header 'Nonce;' \
--header 'CurTime;' \
--header 'CheckSum;' \
--header 'Content-Type: application/json' \
--data-raw '{
"translator_config": {
"strict": true
},
"operator_account_id": "string",
"source_text": "string",
"source_language": "string",
"target_language": "string"
}'
返回响应
🟢200成功
application/json
Body
code
integer
必需
msg
string
必需
data
object
必需
translated_text
string
必需
source_language
string
必需
target_language
string
必需
示例
{"code":200,"msg":"success","data":{"translated_text":"สวัสดีประเทศจีน","source_language":"zh-CHS","target_language":"th"}}