Translate Document API

Hello All,

Getting below response for calling document translation API, not sure what the issue is. I am passing the correct JSON body as suggested in the documentation. I am using Postman to serve this request. I am generating token before calling it and entering in it for authorization.

URL -  https://api.groupdocs.cloud/v1.0/translation/document

Request --

{
  "format": "rtf",
  "outformat": "rtf",
  "pair": "en-fr",
  "name": "sample_rtf.rtf",
  "folder": "InternalStorage",
  "savepath": "InternalStorage",
  "savefile": "sample_rtf_trns.rtf",
  "storage": "InternalStorage",
  "masters": "false",
  "elements": "[]"
}

Responses -

{
“requestId”: “30ec803c-3afe-4e08-8906-f95e690a4301”,
“error”: {
“code”: “errorInvalidInputData”,
“message”: “: Unexpected character encountered while parsing value: {. Path ‘’, line 1, position 1.”,
“description”: “Operation Failed. The input data is not valid.”,
“dateTime”: “2023-06-09T06:28:17.3996404Z”,
“innerError”: null
}
}

Pls suggest.

Thanks in advance.

@atuldalvi123,

Kindly share your input document as well. It will help us investigate the issue.

Is that JSON body correct ?
I feel there is some issue in the JSON

@atuldalvi123

We are checking the JSON and will share the information with you shortly.

Hello,

Now I am sending the correct json from postman and it triggers the server as well but the response I am getting is not what I expected.

JSON -

‘[ { “format”: “rtf”,
“outformat”: “rtf”,
“pair”: “en-fr”,
“name”: “sample_rtf.rtf”,
“folder”: “InternalStorage”,
“savepath”: “InternalStorage”,
“savefile”: “sample_rtf_trns.rtf”,
“storage”: “InternalStorage”}]’

Response -

{
“status”: “error”,
“message”: “file sample_rtf.rtf does not exist on path InternalStorage”,
“duration”: 0.0,
“details”: null,
“errors”: null
}

My files are available on there storage not sure why it is throwing this error.

Pls check and let me know the issue.

Thanks in advance.

@atuldalvi123

Please find below a sample cURL command to translate a supported document. Please note that I am using a file from the default cloud storage root, so I am passing null values for folder and storage. Hopefully, it will help you to accomplish the task.

curl -X POST "https://api.groupdocs.cloud/v1.0/translation/document" 
-H "accept: application/json" 
-H "authorization: Bearer eyJhbGciOiJSUzI1NiI...........TPhR44mqGUJxoN1qbg" 
-H "Content-Type: application/json" 
-H "x-aspose-client: Containerize.Swagger" 
-d "'[{"name":"test_file.docx","folder":null,"storage":null,"format":"docx","outformat":"docx","savefile":"translation2.docx","pair":"en-fr"}]'"