Skip to main content

Notifications

Power Automate - Connector Development
Unanswered

The API operation requires the property 'body' to be of type 'Object' but is of type 'String'.

(0) ShareShare
ReportReport
Posted on by

Hello all, 

 

I am developing my own connector with an action that should return html text by id using api method.

 

My connector action is described as following:

paths:

/getTemplate:
get:

produces: [application/json, text/html]
parameters:
- {name: id, in: query, description: Template ID, required: true, type: string}
responses:
default:
description: default
schema:
type: object
properties:
template: {type: string, description: template, title: '', format: html}

 

If I pass the template as 'text/html' my flow failed with error 'The API operation "getTemplate" requires the property 'body' to be of type 'Object' but is of type 'String'.'

If I pass the template as application/json, I convert the HTML to base64 string and put it to JSON object, but in this way I get the same base64 string (not HTML) in response. My JSON object looks like the following:
{ 'template': '<base64>' }

 

How I can pass and get HTML text in the connector action?

 

Thank you.

Regards.

  • SameerCh Profile Picture
    SameerCh on at
    Re: The API operation requires the property 'body' to be of type 'Object' but is of type 'String'.

    Your schema definition should match the response payload.

     

    If you API returns the HTML payload directly, you will describe it as:

     schema: { type: string}, or

     schema: { type: string, format: binary }   // if you think the payload are not text

     

    If your API returns the HTML payload wrapped in JSON, like below:

    {

       "template": "<html>....</html>"

    }

    Then your schema definition would be:

     schema: {

       type: object,

       properties: {

          template: { type: string }
       }

     }

     

    Finally, If your API returns the HTML payload wrapped in JSON and encoded, like below:

    {

       "template": "base64encoded HTML string"

    }

    Then your schema definition would be:

     schema: {

       type: object,

       properties: {

          template: { type: string, format: byte }
       }

     }

     

    Hope this clarifies.

     

    We also provide an experience to generate the schemas from sample payload.

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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,567

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,907

Leaderboard

Featured topics