cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
WebPortal
Post Prodigy
Post Prodigy

Custom connector error "JSON parsing error, expected 'object' but got 'string'.",

I've got a custom connector that calls an Azure Function as Web API.

 

The API is working well, and returning a JSON as response.

 

It seems Power Apps does not like strings as responses, so after a very extensive research, I've updated the function to dump the content as JSON.

 

All I want is to call the web API and get the response in a label.

 

So, I have a button with:

Set(resposta, TesteAPI.httpexample(TextInput1.Text))

 

And a label with:

resposta.body

 

But resposta is empty.

 

And from the monitor, I see that the API is correctly executed:

WebPortal_0-1636317644434.png

 

But the response isn't updated:

WebPortal_1-1636317670838.png

 

This is my API defintion:

swagger: '2.0'
info: {title: TesteAPI, description: '', version: '1.0'}
host: xxx.azurewebsites.net
basePath: /api
schemes: [https]
consumes: [application/json]
produces: [application/json]
paths:
/httpexample:
get:
responses:
default:
description: default
schema:
type: string
properties:
duration: {type: integer, format: int32, description: duration}
size: {type: integer, format: int32, description: size}
status: {type: integer, format: int32, description: status}
headers:
type: string
properties:
Content-Type: {type: string, description: Content-Type}
Date: {type: string, description: Date}
x-ms-apihub-cached-response: {type: boolean, description: x-ms-apihub-cached-response}
description: headers
body: {type: string, description: body, title: '', x-ms-visibility: important}
responseType: {type: string, description: responseType}
x-ms-visibility: important
summary: devolve o nome
description: apenas um exemplo ok
operationId: httpexample
parameters:
- {in: query, name: name, type: string, required: true}
definitions: {}
parameters: {}
responses: {}
securityDefinitions: {}
security: []
tags: []

 

I've tried a million things but nothing works, I've read the whole Azure, Power Apps and Swagger documentation but nothing works. This should be so easy.

 

Can anyone help?

 

Thanks in advance!

1 REPLY 1
PTBBSolutions
Solution Supplier
Solution Supplier

Hi @WebPortal,

 

I had a similar issue - still not sure why is it happening.

 

The way I did it, create a flow which executes you API call on PowerApps button click, and use the flow to return the value for use.


please let me know if you need further assistance.

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (5,540)