I am trying to use the Azure Document Translation Service to translate a Document from English to Janapese. The hierarchy of the BLOB is given below.
|-storage account
|--container (test)
|---translation-input url (ex:https://storageaccount/test/sampleTranslation.docx)
|---translation-output url (ex:https://storageaccount/test/Converted_sampleTranslation.docx)
I am doing with httpclient using json input:
{
"inputs":[
{
"storageType":"File",
"source":{
"sourceUrl":"https://storageaccount/test/sampleTranslation.docx?sp=racwl&st=24Z&se=2025-07-31T17:58:24Z&spr=https&sv=2020-08-04&sr=c&sig=xsd%3D%3D"
},
"targets":[
{
"targetUrl":"https://storageaccount/test/Converted_sampleTranslation.docx?sp=racwl&st=kjkZ&se=2025-07-31T17:58:24Z&spr=https&sv=2020-08-04&sr=c&sig=3LT7WCD5Tn7KK1JBTxaSOs%3D",
"language":"ja"
}
]
}
]
}
Code snippet:
HttpClient client = new HttpClient();
HttpRequestMessage request = new HttpRequestMessage();
{
StringContent content = new StringContent(json, Encoding.UTF8, "application/json");
request.Method = HttpMethod.Post;
request.RequestUri = new Uri(endpoint + route);
request.Headers.Add("Ocp-Apim-Subscription-Key", subscriptionKey);
request.Content = content;
HttpResponseMessage response = await client.SendAsync(request);
string result = response.Content.ReadAsStringAsync().Result;
if (response.IsSuccessStatusCode)
{
outcome = "https://storageaccount.blob.core.windows.net/test/" + fname;
}
else
log.Error("Error in Translate Document");
}
I am getting response status is 202 (means successful) but there is no translation happening with specified targeturl,
Note: Same code worked as expected in few months before. But today not getting expected result. what is the issue?
This worked for me.
sourcewithread &listaccess, for translated file:targetwithread,write&listaccess, I generated container level SAS.My code:OUTPUT:it created a same name file in container with translated language.