Download DOCX file from API

  1. My goal: get a docx file from API and download it using utils.downloadFile

  2. Issue: data I get from API is in the next format: {message: }. It looks like a broken string and I can’t download my docx file properly

  3. Steps I've taken to troubleshoot: I tried using another endpoint, which downloads a zip file, and it comes back in a suitable for downloading format: {base64Data, name, sizeBytes, type}
    Also, when trying to use this endpoint from other sources (Swagger, Postman) - the file actually returns as byte64

    Is there a way to retrieve docx file in the same format zip files come?

    The most similar issue I saw on this forum was this: Download a file from API , but it seem like it got fixed by making Retool handle xls files properly

1 Like

Hi @Dzhmilka,

I'm not sure I understand what the issue is. Is it that your API call is not returning the {base64Data, name, sizeBytes, type} data you're expecting? If so, isn't this rather an issue with your endpoint rather than retool?

If this isn't the case, and your endpoint is indeed returning data in some format, would you mind sharing a screenshot of the data being returned?

Thanks!

Hi @MiguelOrtiz ,

It seemed at first like a Retool issue because, with the same configurations on different endpoints, I received {base64Data, name, sizeBytes, type} by default on one endpoint, and {message} on the other. So I thought maybe Retool handles ZIP files properly but not DOCX files

However, I can confirm that explicitly setting the proper Content-Type on the backend side resolved this issue

1 Like