How should my request look for synchronous document translation (Error: The Document field required)

Joe Petrakovich 0 Reputation points
2024-09-16T03:11:33.5666667+00:00

I'm trying to use synchronous document translation but am getting a "The Document field is required" error.

I've included the document as an HTML file sent as a blob in FormData. I also tried adding and removing the query string document param even though I don't really understand the point of a file path since the document itself is in the body, so there's not really path.. I just made one up..

How can I get this to work?

User's image

Azure Translator
Azure Translator
An Azure service to easily conduct machine translation with a simple REST API call.
414 questions
Azure Startups
Azure Startups
Azure: A cloud computing platform and infrastructure for building, deploying and managing applications and services through a worldwide network of Microsoft-managed datacenters.Startups: Companies that are in their initial stages of business and typically developing a business model and seeking financing.
386 questions
{count} votes

1 answer

Sort by: Most helpful
  1. romungi-MSFT 46,831 Reputation points Microsoft Employee
    2024-09-17T08:02:13.06+00:00

    @Joe Petrakovich I think the problem here is with the missing @ in the file path, here is my actual request that worked.

    User's image

    Here is the path format that you have to use for file parameter.

    -F "document=@"C:\Users\romungi\margies_faq.docx";type=application/vnd.openxmlformats-officedocument.wordprocessingml.document"

    Final output of my file translated to Spanish:

    User's image

    I think the documentation did not cover the missing @ in the path for document parameter causing this confusion. Please retry with this change and I think it should work for you.

    Also, this platform blocks some requests when it thinks the code snippet is malicious, in that case, use the screenshot as you have done above. Thanks!!

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.