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.