翻訳タスクAPI
翻訳テキスト
テキストを翻訳し、翻訳結果を同期して返します。
- 完全な住所
- https://dltranslator.com/api/v1/translation/translateTexts
- 認証
- Authorizationリクエストヘッダーに API Key を渡す必要があります
- Content-Type
- application/json
- 誤った形式
- { "error": "Invalid API key." }
注意事項
このインターフェースは、渡されたテキストを一時的にJSONドキュメントとして保存し、同期処理を行います。少量のテキストの即時翻訳に適しています。
アカウントのポイント残高が最低2 credits必要です。実際の費用が残高を超える場合、インターフェースはtaskIdとpriceを返し、残高不足を通知します。
例
1curl -X POST 'https://dltranslator.com/api/v1/translation/translateTexts' \
2--header 'Authorization: [yourSecretKey]' \
3--header 'Content-Type: application/json' \
4--data '{
5 "texts": [
6 "string"
7 ],
8 "fromLang": "[string]",
9 "toLang": "[string]"
10}'リクエストパラメータ
| パラメータ | タイプ | デフォルト | 説明 | 例 |
|---|---|---|---|---|
| 必須: texts | String[] | - | 翻訳が必要なテキスト | - |
| 必須: fromLang | String | - |
| - |
| 必須: toLang | String | - |
| - |
| model | String | - |
| - |
| fileDescription | String | - | 文書説明。追加情報を提供することで翻訳品質を向上させます。例えば、文書の背景情報やその他の翻訳要件の追加など | - |
レスポンス
| パラメータ | タイプ | デフォルト | 説明 | 例 |
|---|---|---|---|---|
| taskId | String | - | タスクID | - |
| translatedTexts | String[] | - | 翻訳後のテキスト | - |
| price | Integer | - | 全体翻訳に必要なクレジット数 | - |
| usedCredits | Integer | - | 翻訳タスクで使用済みのCredits数 | - |
よくあるエラー
401 Missing API key.
The Authorization request header is required.
401 Invalid API key.
The API key does not exist, has been deleted, or is no longer valid.
402 Insufficient credits balance.
The account does not have enough credits to translate the texts.
400 Missing required parameter: fromLang.
Provide fromLang using a language returned by /api/v1/languages.
400 Missing required parameter: toLang.
Provide toLang using a language returned by /api/v1/languages.
400 Missing required parameter: texts.
Provide a non-empty texts array.
400 Failed to translate texts.
The text translation task could not be processed.