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)
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.
Directly using postman to test the API that the custom connector is built for works.
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.
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": {} }
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
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!
@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.
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
Announcing a new way to share your feedback with the Power Automate Team.
Learn to digitize and optimize business processes and connect all your applications to share data in real time.
User | Count |
---|---|
41 | |
17 | |
16 | |
15 | |
12 |
User | Count |
---|---|
67 | |
36 | |
27 | |
20 | |
17 |