cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Saganty
New Member

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
Shanescows
Super User
Super User

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
Shanescows
Super User
Super User

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

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
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (1,085)