Bilješka
Pristup ovoj stranici zahtijeva provjeru vjerodostojnosti. Možete pokušati da se prijavite ili promijenite direktorije.
Pristup ovoj stranici zahtijeva provjeru vjerodostojnosti. Možete pokušati promijeniti direktorije.
Convert characters or letters of a source language to the corresponding characters or letters of a target language.
Request URL
POST request:
POST http://localhost:{port}/transliterate?api-version=3.0&language={language}&fromScript={fromScript}&toScript={toScript}
See Virtual Network Support for Translator selected network and private endpoint configuration and support.
Request parameters
Request parameters passed on the query string are:
| Query parameter | Description | Condition |
|---|---|---|
| api-version | Version of the API requested by the client. Value must be 3.0. |
Required parameter |
| language | Specifies the source language of the text to convert from one script to another. | Required parameter |
| fromScript | Specifies the script used by the input text. | Required parameter |
| toScript | Specifies the output script. | Required parameter |
- You can query the service for
transliterationscope supported languages. - See also Language support for transliteration.
Request headers
| Headers | Description | Condition |
|---|---|---|
| Authentication headers | See available options for authentication | Required request header |
| Content-Type | Specifies the content type of the payload. Possible value: application/json |
Required request header |
| Content-Length | The length of the request body. | Optional |
| X-ClientTraceId | A client-generated GUID to uniquely identify the request. You can omit this optional header if you include the trace ID in the query string using a query parameter named ClientTraceId. |
Optional |
Response body
A successful response is a JSON array with one result for each element in the input array. A result object includes the following properties:
text: A string that results from converting the input string to the output script.script: A string specifying the script used in the output.
Response headers
| Headers | Description |
|---|---|
| X-RequestId | Value generated by the service to identify the request. It can be used for troubleshooting purposes. |
Sample request
curl -X POST "http://localhost:5000/transliterate?api-version=3.0&language=ja&fromScript=Jpan&toScript=Latin"
Sample request body
The body of the request is a JSON array. Each array element is a JSON object with a string property named Text, which represents the string to convert.
[
{"text":"こんにちは"},
{"text":"さようなら"}
]
The following limitations apply:
- The array can have a maximum of 10 elements.
- The text value of an array element can't exceed 1,000 characters including spaces.
- The entire text included in the request can't exceed 5,000 characters including spaces.
Sample JSON response:
[
{
"text": "Kon'nichiwa",
"script": "Latin"
},
{
"text": "sayonara",
"script": "Latin"
}
]
Note
- Each sample runs on the
localhostthat you specified with thedocker runcommand. - While your container is running,
localhostpoints to the container itself. - You don't have to use
localhost:5000. You can use any port that'sn't already in use in your host environment.
Transliterate with REST API
curl -X POST "http://localhost:5000/transliterate?api-version=3.0&language=ja&fromScript=Jpan&toScript=Latin" -H "Content-Type: application/json" -d "[{'Text':'こんにちは'},{'Text':'さようなら'}]"