Skip to main content

Notifications

Power Automate - Building Flows
Suggested answer

API - Base64ToBinary

Posted on by
Hello everyone,
I’m working on a Power Automate flow to download a ZIP file from an API and save it in a SharePoint folder. The file returned by the API is encoded in Base64, and I’m using the base64ToBinary function to convert it to binary content before creating the file.
The flow runs successfully, and the file is saved with a .zip extension. However, when I try to open the file, I get an error saying it’s corrupted or in an unsupported format.
Additional details:
  • The API response includes:$content: Base64-encoded content
    $content-type: application/zip
    Content-Disposition header: includes a valid filename
    Content-Length: 5704 bytes

     
My questions:
  1. Could I be missing a step in processing the content before creating the file?
  2. How can I ensure that the data from the API is correctly passed to Power Automate and saved as a valid ZIP file?
I’d really appreciate your help!
  • Suggested answer
    SaiRT14 Profile Picture
    SaiRT14 1,334 on at
    API - Base64ToBinary
    here are the steps:
     
    HTTP Action: Retrieve the file from the API.
    Compose Action: Decode Base64 to binary using -base64ToBinary(outputs('HTTP')?['body']['$content'])
    Create File Action (SharePoint):File Name: Extracted or static filename. File Content: Output from the Compose action.
    let me know if you need mor details. 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

November 2024 Newsletter…

November 2024 Community Newsletter…

Community Update Oct 28…

Power Platform Community Update…

Tuesday Tip #7 Community Profile Tips…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 143,591

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 64,090

Leaderboard