cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
joneillhso
Level: Powered On

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.

 

EmbargoCheckFlow.4.jpgErrorEmbargoCheckFlow.3.jpgFlow on this button, data returned (no status code or response body) stored in collection and displayed in gallery on next screenEmbargoCheckFlow.2.jpgAttempt to change response JSONEmbargoCheckFlow.1.jpgFlow

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
joneillhso
Level: Powered On

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

5 REPLIES 5
Dual Super User
Dual Super User

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.
joneillhso
Level: Powered On

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

Dual Super User
Dual Super User

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.
joneillhso
Level: Powered On

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

Dual Super User
Dual Super User

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.

Helpful resources

Announcements
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!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Solution Authors
Top Kudoed Authors (Last 30 Days)
Users online (4,972)