cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

HTTP Request Response to Powerapp using JSON - missing status code and body of response

Hi,

 

I have a flow that takes new/potential customers account information, performs a http put request to check if the company has an embargo according to a website. I need the information passed back to a powerapp. Most information is there but i can't get the response status code and the body of the response into the powerapp.

I am currently storing the response in a collection in the powerapp, it is just missing status code and the body of the response.

 

I have been trying to change the response so that the status code is in the response json. My json knowledge is limited and my attempts lead to no information coming back to the app.

I need the response status code and body in the app so I can patch them into a CDS entity, along with other company & embargo information. Any help would be appreciated.

 

If you need any more information please ask.

 

ErrorErrorFlow on this button, data returned  (no status code or response body) stored in collection and displayed in gallery on next screenFlow on this button, data returned (no status code or response body) stored in collection and displayed in gallery on next screenAttempt to change response JSONAttempt to change response JSONFlowFlow

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Frequent Visitor

Re: HTTP Request Response to Powerapp using JSON - missing status code and body of response

I have attempted what you recommended but can't get it to work. I think the sub string function requires the length of string (which will vary based on number of results), as well as where it starts:

 

Substring.function.info.jpg

View solution in original post

7 REPLIES 7
Highlighted
Dual Super User II
Dual Super User II

Re: HTTP Request Response to Powerapp using JSON - missing status code and body of response

I think you need to trim the '{' off the front of the JSON before you add in the status code.  it should read more like 

{"StatusCode":200,"recordsFound":3,"matches":[...

You want the status code to be one of the fields in the JSON body. 



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
Highlighted
Frequent Visitor

Re: HTTP Request Response to Powerapp using JSON - missing status code and body of response

Thanks for the reply. 

How would I go about getting the first '{' out of the JSON? This is the first time I have ever worked with JSON

Highlighted
Dual Super User II
Dual Super User II

Re: HTTP Request Response to Powerapp using JSON - missing status code and body of response

JSON is data represented as a string.  So when you concat your new field with the existing JSON make sure to use substring() to retrieve everything except the first character.  Something like this.

Concat({"StatusCode":outputs('HTTP')['StatusCode'],",",substring(body('HTTP'),1))


-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
Highlighted
Frequent Visitor

Re: HTTP Request Response to Powerapp using JSON - missing status code and body of response

I have attempted what you recommended but can't get it to work. I think the sub string function requires the length of string (which will vary based on number of results), as well as where it starts:

 

Substring.function.info.jpg

View solution in original post

Highlighted
Dual Super User II
Dual Super User II

Re: HTTP Request Response to Powerapp using JSON - missing status code and body of response

If the substring() is requiring the third parameter you can supply that using the Length() function minus 1.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
Highlighted
Advocate V
Advocate V

Re: HTTP Request Response to Powerapp using JSON - missing status code and body of response

Can you point me in the direction of the Microsoft documentation on Request Response?

 

Request Response.png

 

Highlighted
Dual Super User II
Dual Super User II

Re: HTTP Request Response to Powerapp using JSON - missing status code and body of response

https://docs.microsoft.com/en-us/azure/connectors/connectors-native-reqres 



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Helpful resources

Announcements
firstImage

Super User Program Update

Three Super User rank tiers have been launched!

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

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

Top Kudoed Authors
Users online (8,260)