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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Sending multipart/form...
Power Automate
Unanswered

Sending multipart/form-data request with 'HTTP with Azure AD' connector

(0) ShareShare
ReportReport
Posted on by 53

I need to send an HTTP request with multipart/form-data via the 'HTTP with Azure AD' connector rather than the 'HTTP' connector since this will allow me to use an on-premises gateway.   I have found documentation and examples for doing this with the standard HTTP connector but I cannot get the equivalent to work with the 'HTTP with Azure HD' connector.  The endpoint is returning "Current request is not a multipart request".  Does anyone have a working example of a multipart/form-data request working with this connector?

 

Using Postman, this is a sanitized version of the request which works:

 

POST /bm-import-api-adaptor/api/ProductOfferingForAccessoriesPlan?ImportExtensions=false&description=test HTTP/1.1
Host: hostname.company.com
accept: */*
Authorization: Bearer faketoken1eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJEQkxyeEs5YjFvZlhQSXhJYkFEZFMybUxkcDVfQnF5WFE3bVZQbXRnWS1nIn0.eyJleHAiOjIxMjI5MjY3MDYsImlhdCI6MTY5MDkyNjcwNiwianRpIjoiMTQyMzQ5ZmQtMzViNy00OTBjLWI1ZjktNzI0MjJhZTc2ZmM0IiwiaXNzIjoiaHR0cDovL2tleWNsb2FrLWRldjItYm0ta2V5Y2xvYWsuYXBwcy5ucGUwMy5vY3AuaW50ZXJuYWwuc3BhcmsuY28ubnovYXV0aC9yZWFsbXMvYm0tc3BhcmstbnBlMDMtZ
Content-Length: 279
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW

------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="file"; filename="myfile.xlsx"
Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet

(data)
------WebKitFormBoundary7MA4YWxkTrZu0gW--

 

 

Using the format for the normal HTTP connector, the multipart/form-data is structured like this in the body:

 

{
 "$multipart": [
 {
 "headers": {
 "Content-Disposition": "form-data; name=\"file\"; filename=\"myfile.xlsx"
 },
 "body": {
 "$content-type": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
 "$content": @{body('Get_file_content_using_path')?['$content']}
 }
 }
 ],
 "$content-type": "multipart/form-data"
}

 

 

Any help would be much appreciated.  I have tried everything I can think of with no success.

Categories:
I have the same question (1)
  • SamLed Profile Picture
    2,340 Moderator on at

    Hi,

     

    Have a look to this for JSON body: Solved: Send multi-part form data with flow HTTP task - Power Platform Community (microsoft.com)

     

    And this one where many guys discussed a lot to make it working : Solved: HTTP POST files with multipart/form-data - Power Platform Community (microsoft.com)

    ______________________________________________________________

    If I have answered your question, please Accept the post as solution.
    If you like my response, please Thumbs Up.

  • dmorland Profile Picture
    53 on at

    Those posts relate to the standard HTTP connector not the HTTP with Azure AD connector that I am having problems with. I can't use the standard HTTP connector as I need to send the request via on-premises gateway.

  • Dynamo Profile Picture
    50 on at

    Hi, did you ever find a fix/workaround for this problem? 

  • dmorland Profile Picture
    53 on at

    Yes, from memory the issue I was having was just the formatting of the boundary in the body - I had missed off hyphens on the closing boundary.  But the solution I ended up going with was to create a custom connector for the API and use an action to for my custom connector in the flow.  The endpoint needed an Authorization header so I configured my my connector to accept a JWT value and added an action in the connector to copy the JWT value to the Authorization header

     

    Extract from custom connector defiition:

     /api/Device:
     post:
     tags:
     - XXXXXXX
     summary: Device
     description: Api for importing device
     operationId: DeviceUsingPOST
     consumes:
     - multipart/form-data
     produces:
     - '*/*'
     parameters:
     - name: jwt
     in: header
     description: jwt
     required: true
     type: string
     - name: ImportExtensions
     in: query
     description: ImportExtensions
     required: false
     type: boolean
     default: false
     - name: description
     in: query
     description: description
     required: false
     type: string
     - name: file
     in: formData
     description: Select the file to Upload
     required: true
     type: file
     responses:
     '200':
     description: OK
     schema:
     type: object
     '201':
     description: Created
     '401':
     description: Unauthorized
     '403':
     description: Forbidden
     '404':
     description: Not Found
     deprecated: false

     

    I got the file content from file I am uploading from Sharepoint using Get File Content Using Path action then 

     

    connector.png
    Expression in File/Body is:
    base64tobinary(body('Get_file_content_using_path')?['$content'])

  • Dynamo Profile Picture
    50 on at

    Hi!

    Thanks for the help - just got it working using your approach.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 570

#2
Valantis Profile Picture

Valantis 405

#3
11manish Profile Picture

11manish 350

Last 30 days Overall leaderboard