web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / HTTP: multipart/form-data
Power Automate
Unanswered

HTTP: multipart/form-data

(3) ShareShare
ReportReport
Posted on by

Hi!

 

I’ve started my deepdive into OpenAI and Power Platform and made some good solutions for integrering with both text- and chat completion, through a custom connector with different suitable actions. Works GREAT!

 

I’ve glanced at their Whisper-model, and want to make use of speech-to-text-functionality in Power Platform. Just for fun, at least now to begin with.

 

Where I struggle; the content-type for the api-call is multipart/form-data, so I find i a bit challenging getting the body correct. Works great in Postman, but in Power Automate it’s a no-no.

 

Anyone looked into it and able to point me in the right direction?

 

Here’s the curl in raw format:

 

curl https://api.openai.com/v1/audio/transcriptions \
-X POST \
-H 'Authorization: Bearer TOKEN' \
-H 'Content-Type: multipart/form-data' \
-F file=@/path/to/file/audio.mp3 \
-F model=whisper-1

 

 

Categories:
I have the same question (0)
  • v-xiaochen-msft Profile Picture
    on at

    Hi @Anonymous ,

     

    Please take a look at this nice blog.

    https://willpage.dev/2019/12/20/using-the-http-action-to-post-multipart-form-data-in-power-automate-logic-apps/

    Does it help?

     

    Best Regards,

    Wearsky

  • Community Power Platform Member Profile Picture
    on at

    Feel's like I'm getting closer, but still no luck 😞

    Tried to set up a flow that triggers on HTTP-request, and sent a request to the generated URL from Postman. 

    Getting a nicely formatted body from the output. Tried to switch the decoded value from the file content in the output with the help of the Get File Content-action (OneDrive for Business), but still no luck. Here's a screenshot of my request body:

     

     

  • Archit94 Profile Picture
    8 on at

    Hello @Anonymous , 

    Finally do you found any solution for same ? If  yes please share.

  • Holmer Profile Picture
    2 on at

    Esto debería ayudar:

    Holmer_0-1718291296044.png

     

  • GBURGARDT Profile Picture
    7 on at

    Tengo un problema al intentar enviar un archivo adjunto desde un correo electrónico a la API de OpenAI usando Power Automate.

    Cuando el archivo adjunto es texto plano, funciona bien, pero cuando el archivo es de otro tipo, como un PDF, aunque se sube a OpenAI, el archivo resulta corrupto.

    He intentado agregar "Content-Type": "application/octet-stream" y "Content-Transfer-Encoding": "base64" en los headers del archivo adjunto en la solicitud HTTP multipart/form-data, pero sigue sin funcionar. Parece que al adjuntar el archivo al cuerpo de la petición HTTP, quedan unos caracteres especiales que lo corrompen.

    ¿Tienes alguna idea de dónde podría estar el problema o qué más debería revisar para asegurar que los archivos se envíen correctamente sin corromperse?

    Desde ya, muchas gracias.

    { "$content-type": "multipart/form-data", "$multipart": [ { "headers": { "Content-Disposition": "form-data; name=\"file\"; filename=\"@{outputs('Obtener_Adjunto')?['body/name']}\"", "Content-Type": "application/octet-stream", "Content-Transfer-Encoding": "base64" }, "body": "@{outputs('Obtener_Adjunto')?['body/contentType']}" }, { "headers": { "Content-Disposition": "form-data; name=\"purpose\"" }, "body": "@{variables('Purpose')}" } ] }

     

     

  • aleksKamb Profile Picture
    2 on at

    Hi! I'm literally struggling with the same thing. Any fixes? 

  • GBURGARDT Profile Picture
    7 on at
    This is the request to the OpenAI files endpoint. To ensure the
    file does not become corrupted in OpenAI, the key is to put the content
    bytes inside a String function
    @{string(outputs('Get_Attachment_(V2)')?['body/contentBytes'])}
     
     
    URL

    Method
    POST

    Headers
    Authorization Bearer sk-proj-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    Body                                
    {
      "$content-type": "multipart/form-data",
      "$multipart": [
        {
          "headers": {
            "Content-Disposition": "form-data; name=\"purpose\""
          },
          "body": "fine-tune"
        },
        {
          "headers": {
            "Content-Disposition": "form-data; name=\"file\"; filename=\"@{outputs('Get_Attachment_(V2)')?['body/name']}\""
          },
          "body": {
            "$content-type": "@{outputs('Get_Attachment_(V2)')?['body/contentType']}",
            "$content": "@{string(outputs('Get_Attachment_(V2)')?['body/contentBytes'])}"
          }
        }
      ]
    }

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 501 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard