cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
joneillhso
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

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
Pstork1
Dual Super User III
Dual Super User III

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.

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

Pstork1
Dual Super User III
Dual Super User III

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.

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

Pstork1
Dual Super User III
Dual Super User III

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.
schuess3
Kudo Kingpin
Kudo Kingpin

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

 

Request Response.png

 

Pstork1
Dual Super User III
Dual Super User III

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

Manage your user group events

Check out the News & Announcements to learn more.

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

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.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Top Solution Authors
Users online (2,384)