cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Saganty
Level: Power Up

PowerApps JSON Request

I am trying to build a proof of concept where a field in a PowerApp is validated against a custom api held in an Azure Function. I have created the swagger file for the function which for demo purposes just uses the following JSON as the body in a POST request, and returns a text value back

 

{

   Text1:string,

   Text2:string,

   Text3:string

}

 

I have been able to create a custom connector and when used in MS Flow I get presented with the 3 text boxes and it all works fine. My problem comes when calling the same custom connector from PowerApps, since I cannot see how to build a JSON body. Just to prove the concept I am trying to set Text1 to "Text 1", Text2 to "Text 2" and Text3 to "Text 3"

 

I have tried many variations of the following, where I try and set a variable to the return value and sometimes use char(34) to try and force " into the string, but the body always seems to have the complete string inserted into the Text1 JSON element, and Text 2 and Text 3 are empty

 

Set(ValidationText,PoC.Validate("{" & Char(34) & "Text1" & Char(34) & ":" & Char(34) & "Text 1" & Char(34) & "," & Char(34) & "Text2" & Char(34) & ":" & Char(34) & "Text 2 Value" & Char(34) & "," & Char(34) & "Text3" & Char(34) & ":" & Char(34) & "Text 3 Value" & Char(34) & "}"))

 

So in this case when the request arrives at the function Text1 would end up as the string

{"Text1":"Text 1","Text2":"Text 2 Value","Text3":"Text 3 Value"}

and Text2 and Text 3 empty

 

So how can I construct a JSON body and pass it to ValidationText.POC.Validate, when PowerApps thinks there is just the one parameter required for the function?

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: PowerApps JSON Request

Not exactly an answer but a different perspective.

 

For me, Flow is so much better at this stuff. What I do with my apps is have PowerApps call Flow. Let Flow deal with the API stuff and then have Flow return to PowerApps just the values I needed. No more PowerApps JSON chaos. Might be worth considering.

Shane - Microsoft MVP, YouTube, and PowerApps Consulting for when you are in a bind to get this fixed quickly. And finally we now have PowerApps Training

View solution in original post

2 REPLIES 2
Super User
Super User

Re: PowerApps JSON Request

Not exactly an answer but a different perspective.

 

For me, Flow is so much better at this stuff. What I do with my apps is have PowerApps call Flow. Let Flow deal with the API stuff and then have Flow return to PowerApps just the values I needed. No more PowerApps JSON chaos. Might be worth considering.

Shane - Microsoft MVP, YouTube, and PowerApps Consulting for when you are in a bind to get this fixed quickly. And finally we now have PowerApps Training

View solution in original post

Saganty
Level: Power Up

Re: PowerApps JSON Request

AhI never thought of that option. Being new to PowerApps, I just assumed that it would handle api connections created  with swagger files the same way as Flow does, but my recent experince with PowerApps seems to contradict that. I will certainly give it a go, and report back if it solves the issue. Many thanks

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (6,414)