I am using translator resource to translate the one document at a time from the source container through python code.
Following the documentation, generated the container level SAS for existing containers.
Tried different combinations of request body formats to meet the requirement of translating the single file from source container using "Container level SAS".
I was able to translate various documents but suddenly the python code is failing with the error -
{ 'status': 'ValidationFailed', 'error': {'code': 'InvalidRequest', 'message': 'Cannot access source document location with the current permissions.', 'target': 'Operation', 'innerError': {'code': 'InvalidDocumentAccessLevel', 'message': 'Cannot access source document location with the current permissions.'}}, 'summary': {'total': 0, 'failed': 0, 'success': 0, 'inProgress': 0, 'notYetStarted': 0, 'cancelled': 0, 'totalCharacterCharged': 0}}
When same request bodies are tried for newly created containers, documents are translating successfully.
** Does existing containers gives this issue sometimes and we should always use the newly created containers?**
Old container's SAS urls are generated with appropriate permissions i.e. Read,list for source and Write.List for Target container.
Please suggest me the correct way.
Also attaching the different request body formats I am using to take single file at a time using "Container level SAS"
- Specifying the file name in source url and target url
{
"inputs": [
{
"storageType": "File",
"source": {
"sourceUrl": "https://myblob.blob.core.windows.net/src_container/file.docx?<SAS>"
},
"targets": [
{
"targetUrl":"https:/myblob.blob.core.windows.net/container/<target_blob_name_without_any_extension>?
<SAS>",
"language": "fr"
}
]
}
]
}
- Specifying the file name as suffix in the source {
"inputs": [
{
"source": {
"sourceUrl": "https://myblob.blob.core.windows.net/src_container/file.docx?<SAS>",
"suffix":"file.docx"
},
"targets": [
{
"targetUrl":"https:/myblob.blob.core.windows.net/container/<target_blob_name_without_any_extension>?
<SAS>",
"language": "fr"
}
]
}
]
}
Which is the correct way of achieving the use case using "Container level SAS".
Am I doing something wrong in request body ?
Quick help is needed. Can anyone guide me please?