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 / Custom connector expec...
Power Automate
Unanswered

Custom connector expecting application/xhtml+xml, getting text/plain via flow

(0) ShareShare
ReportReport
Posted on by 635

I am trying to connect to an API (Microsoft Graph connection to OneNote with app registration via Azure, appropriate rights etc) that (for my use case) expects one xhtml file (Presentation part, the page posted to onenote)
    application/xhtml+xml
and a picture (card part, a picture for extract.businesscard) as part of a
   multipart/form-data
POST request.
I already built a custom connector with a swagger (OpenAPI 2) file but cannot successfully feed the xhtml/Presentation part.
I need to do it this way because extract.businesscard only seems to work for these multipart requests.
Sending just the html with the image embedded as base64 image does not generate the extracted business card section with embedded vcf.

My flow (simplified and abridged) consists of a
    http-Request
trigger followed by my custom connector which gets passed, expecting first the picture, then the xhtml
    card: triggerMultipartBody(0)
    Presentation: triggerMultipartBody(1)
2018-07-27 10_14_28-Edit your flow _ Microsoft Flow.png
I don't know what

card (file name), Presentation (file name)
are supposed to do.

Testing the flow with postman (posting to the http-Request trigger url), the flow basically works, but the Content-Type of the xhtml/Presentation part of the multipart/form-data request seems to get messed up.
2018-07-27 10_13_50-Postman.png2018-07-27 10_15_12-Run History _ Microsoft Flow.png

Directly using postman to test the API that the custom connector is built for works.
2018-07-27 10_29_59-Postman.png
I also tried using an exported Postman v1 of this Postman request.
This generates a connector with a strange key/value-something (json?) trigger() that I can't feed at all from flow.

  1. Is my problem because of my custom connector/swagger (swagger file at end of this post)?
    As far as I've read (and tested), OpenAPI 3 allows Content-Type declarations for multipart-formdata requests, but OpenAPI 3 is not supported by Custom Connectors.
    Is there a microsoft vendor extension for the swagger/OpenAPI 2 to enforce Content-Type for multipart-formdata?
  2. Or do I need to change the flow?
  3. Or do something with "file name"?

PS: my swagger file for the custom connector, the /me get action is just for authentification testing purposes.
The /me/onenote/pages post action causes my issues.

{
 "info": {
 "title": "Graph OneNote",
 "description": "Access OneNote via Graph API",
 "version": "1.0.1"
 },
 "paths": {
 "/v1.0/me": {
 "get": {
 "summary": "Get me",
 "operationId": "GetMe",
 "responses": {
 "200": {
 "description": "OK",
 "schema": {
 "type": "object",
 "properties": {
 "@odata.context": {
 "type": "string"
 },
 "id": {
 "type": "string"
 },
 "businessPhones": {
 "type": "array",
 "items": {
 "type": "string"
 }
 },
 "displayName": {
 "type": "string"
 },
 "givenName": {
 "type": "string"
 },
 "jobTitle": {
 "type": "string"
 },
 "mail": {
 "type": "string"
 },
 "mobilePhone": {
 "type": "string"
 },
 "officeLocation": {
 "type": "string"
 },
 "preferredLanguage": {
 "type": "string"
 },
 "surname": {
 "type": "string"
 },
 "userPrincipalName": {
 "type": "string"
 }
 }
 }
 }
 },
 "parameters": []
 }
 },
 "/v1.0/me/onenote/pages": {
 "post": {
 "summary": "Create new OneNote Page with picture",
 "operationId": "PostPage",
 "consumes": [
 "multipart/form-data"
 ],
 "responses": {
 "201": {
 "description": "Created new page with uploaded picture",
 "schema": {
 "type": "object",
 "properties": {
 "@odata.context": {
 "type": "string"
 },
 "id": {
 "type": "string"
 },
 "self": {
 "type": "string"
 },
 "createdDateTime": {
 "type": "string"
 },
 "title": {
 "type": "string"
 },
 "createdByAppId": {
 "type": "string"
 },
 "contentUrl": {
 "type": "string"
 },
 "lastModifiedDateTime": {
 "type": "string"
 },
 "links": {
 "type": "object",
 "properties": { 
 "oneNoteClientUrl": {
 "type": "string"
 },
 "oneNoteWebUrl": {
 "type": "string"
 }
 }
 }
 }
 }
 }
 },
 "parameters": [
 {
 "in": "formData",
 "name": "card",
 "type": "file",
 "description": "a picture",
 "required": true,
 "x-ms-media-kind": "image"
 },
 {
 "in": "formData",
 "name": "Presentation",
 "type": "file",
 "required": true
 }
 ]
 }
 }
 },
 "security": [
 {
 "OAuth2": []
 }
 ],
 "swagger": "2.0",
 "schemes": [
 "https"
 ],
 "host": "graph.microsoft.com",
 "basePath": "/",
 "securityDefinitions": {
 "OAuth2": {
 "type": "oauth2",
 "flow": "accessCode",
 "authorizationUrl": "https://login.windows.net/common/oauth2/authorize?resource=https://graph.microsoft.com",
 "tokenUrl": "https://login.microsoftonline.com/common/oauth2/token",
 "scopes": {}
 }
 },
 "x-components": {}
}

 

Categories:
  • v-yamao-msft Profile Picture
    Microsoft Employee on at

    Hi @SaWu,

     

    The error message says that the Presentation part content type should be text/html or application/xhtml+xml while you are using text/plain.

     

    Please check the content type you are using and make sure it is text/html or application/xhtml+xml.

     

    More details about custom connectors, please check the following docs:

    Custom connectors in Microsoft Flow

    Create your custom integrations in Microsoft Flow using our new and improved Custom API experience

     

     

    Best regards,

    Mabel Mao

  • SaWu Profile Picture
    635 on at

    As I've already written:
    "Testing the flow with postman (posting to the http-Request trigger url), the flow basically works, but the Content-Type of the xhtml/Presentation part of the multipart/form-data request seems to get messed up."

    So, yes, @v-yamao-msft,I should be using application/xhtml+xml.

    I don't know how to do that.
    I am not actively using text/plain.
    I don't set text/plain anywhere.
    I just forward (parts of) the body of a multipart/form-data request from a http trigger to a custom connector.

    Please, tell me how to use (or force the use of) application/xhtml+xml!

  • augpark Profile Picture
    2 on at

    @SaWu , were you ever able to figure this out? I'm trying to create a custom connector to do a similar call. I'm looking to add the PDF contents of a document into a OneNote page but it's expecting a multipart/form-data request with Presentation with a Content-Type of text/html and the file binary data with a Content-Type of application/pdf. But I'm a little unsure of how to set up this call in the custom connector. 

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
11manish Profile Picture

11manish 273 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 235

#3
David_MA Profile Picture

David_MA 172 Super User 2026 Season 2

Last 30 days Overall leaderboard