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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Custom Connector for X...
Power Automate
Unanswered

Custom Connector for Xero : ResponseSwaggerSchemaValidationFailure Error details: 'The API operation 'xxxxxxx' requires the property 'body' to be of type 'String' but is of type 'Object'.'

(0) ShareShare
ReportReport
Posted on by

I seem to be unable to invoke a REST action passing the body as a JSON object.  

 

Screenshot 2022-10-25 195525.png

I have created a custom connector.  It has several actions.  The custom connector uses OAUTH2.0 and works fine.  The actions that use GET parameters work fine.

 

In test mode in the custom connector the POST method "CreateInvoice" works fine.   (I am using the "Post Raw Body" option to test it).    It also works great in Postman.

 

When invoked from Power Automate it gets the error:

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

 

It appears that Power Automate deems anything that looks like a JSON object (such as the Output of a Compose) and object.

 

The body is defined as an object, yet the error seems to say that the custom connector is expecting a string. 

 

I have added/readded/reauthenticated the custom connector ad infinitum.

 

Any suggestions?

 

(Note: If I redefine the swagger to make the body a string it still works in test but I still get this error:

No data has been processed for this endpoint. This endpoint is expecting Invoice data to be specifed in the request body.)

 

More Detail

 

Here's the step:

Screenshot 2022-10-25 185609.png

 

Here's the run result:

Screenshot 2022-10-25 183615.png

Here is the error text:

 

 

The API 'xero-20invoices-yyyyyyyyyyyyyyyyyyyyyy' returned an invalid response for workflow operation 'xxxxxxxxxxxxxxx' of type 'OpenApiConnection'. Error details: 'The API operation 'CreateInvoice' requires the property 'body' to be of type 'String' but is of type 'Object'.'

 

 

 

Here is the swagger in the custom connector (only the post is relevant, but I included the get just in case):

 

Spoiler (Highlight to read)
 /api.xro/2.0/Invoices:
 get:
 summary: Invoices
 description: Gets a list of invoices
 operationId: Invoices
 parameters:
 - name: xero-tenant-id
 in: header
 required: true
 type: string
 default: '{{xero-tenant-id}}'
 description: xero-tenant-id
 - name: Accept
 in: header
 required: true
 type: string
 default: application/json
 description: Accept
 x-ms-visibility: internal
 - name: Content-Type
 in: header
 required: true
 type: string
 default: application/json
 description: Content-Type
 x-ms-visibility: internal
 responses:
 default:
 description: default
 schema: {}
 post:
 summary: Create Invoice
 description: Create Invoice
 operationId: CreateInvoice
 parameters:
 - name: summarizeErrors
 default: false
 in: query
 type: boolean
 required: true
 x-ms-visibility: internal
 - name: unitdp
 default: 4
 in: query
 type: integer
 required: true
 x-ms-visibility: internal
 - name: xero-tenant-id
 in: header
 required: true
 type: string
 default: '{{xero-tenant-id}}'
 description: xero-tenant-id
 - name: Content-Type
 in: header
 required: true
 type: string
 default: application/json
 description: Content-Type
 x-ms-visibility: internal
 - name: body
 in: body
 schema:
 type: object
 properties:
 Invoices:
 type: array
 items:
 type: object
 properties:
 Type:
 type: string
 description: Type
 Contact:
 type: object
 properties:
 Name:
 type: string
 description: Name
 EmailAddress:
 type: string
 description: EmailAddress
 description: Contact
 LineItems:
 type: array
 items:
 type: object
 properties:
 Description:
 type: string
 description: Description
 Quantity:
 type: string
 description: Quantity
 UnitAmount:
 type: string
 description: UnitAmount
 AccountCode:
 type: string
 description: AccountCode
 description: LineItems
 Date:
 type: string
 description: Date
 Reference:
 type: string
 description: Reference
 description: Invoices
 default:
 Invoices:
 - Type: ACCREC
 Contact:
 Name: Mary Marker
 EmailAddress: marymarker@blah.com
 LineItems:
 - Description: xxxxxxxxxxxxxx for Bill
 Quantity: '1'
 UnitAmount: '200'
 AccountCode: '200'
 - Description: xxxxxxxxxxxxxxx for Mary
 Quantity: '1'
 UnitAmount: '200'
 AccountCode: '200'
 Date: '2022-10-20'
 Reference: ABC123
 required: true
 responses:
 '200':
 description: '200'
 schema:
 type: string
 '400':
 description: '400'
 schema:
 type: object
 properties:
 ErrorNumber:
 type: integer
 format: int32
 description: ErrorNumber
 Type:
 type: string
 description: Type
 Message:
 type: string
 description: Message
 Elements:
 type: array
 items:
 type: object
 properties:
 ValidationErrors:
 type: array
 items:
 type: object
 properties:
 Message:
 type: string
 description: Message
 description: ValidationErrors
 BatchPaymentID:
 type: string
 description: BatchPaymentID
 BankTransactionID:
 type: string
 description: BankTransactionID
 CreditNoteID:
 type: string
 description: CreditNoteID
 ContactID:
 type: string
 description: ContactID
 InvoiceID:
 type: string
 description: InvoiceID
 ItemID:
 type: string
 description: ItemID
 PurchaseOrderID:
 type: string
 description: PurchaseOrderID
 description: Elements

 

 

 

/api.xro/2.0/Invoices: get: summary: Invoices description: Gets a list of invoices operationId: Invoices parameters: - name: xero-tenant-id in: header required: true type: string default: '{{xero-tenant-id}}' description: xero-tenant-id - name: Accept in: header required: true type: string default: application/json description: Accept x-ms-visibility: internal - name: Content-Type in: header required: true type: string default: application/json description: Content-Type x-ms-visibility: internal responses: default: description: default schema: {} post: summary: Create Invoice description: Create Invoice operationId: CreateInvoice parameters: - name: summarizeErrors default: false in: query type: boolean required: true x-ms-visibility: internal - name: unitdp default: 4 in: query type: integer required: true x-ms-visibility: internal - name: xero-tenant-id in: header required: true type: string default: '{{xero-tenant-id}}' description: xero-tenant-id - name: Content-Type in: header required: true type: string default: application/json description: Content-Type x-ms-visibility: internal - name: body in: body schema: type: object properties: Invoices: type: array items: type: object properties: Type: type: string description: Type Contact: type: object properties: Name: type: string description: Name EmailAddress: type: string description: EmailAddress description: Contact LineItems: type: array items: type: object properties: Description: type: string description: Description Quantity: type: string description: Quantity UnitAmount: type: string description: UnitAmount AccountCode: type: string description: AccountCode description: LineItems Date: type: string description: Date Reference: type: string description: Reference description: Invoices default: Invoices: - Type: ACCREC Contact: Name: Mary Marker EmailAddress: marymarker@blah.com LineItems: - Description: xxxxxxxxxxxxxx for Bill Quantity: '1' UnitAmount: '200' AccountCode: '200' - Description: xxxxxxxxxxxxxxx for Mary Quantity: '1' UnitAmount: '200' AccountCode: '200' Date: '2022-10-20' Reference: ABC123 required: true responses: '200': description: '200' schema: type: string '400': description: '400' schema: type: object properties: ErrorNumber: type: integer format: int32 description: ErrorNumber Type: type: string description: Type Message: type: string description: Message Elements: type: array items: type: object properties: ValidationErrors: type: array items: type: object properties: Message: type: string description: Message description: ValidationErrors BatchPaymentID: type: string description: BatchPaymentID BankTransactionID: type: string description: BankTransactionID CreditNoteID: type: string description: CreditNoteID ContactID: type: string description: ContactID InvoiceID: type: string description: InvoiceID ItemID: type: string description: ItemID PurchaseOrderID: type: string description: PurchaseOrderID description: Elements   

 

It looks like it's a similar problem to this one:

Custom Connector with raw body (JSON) 

 

 

 

 

Categories:
I have the same question (0)

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 501 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard