cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Advocate II
Advocate II

Parse/extract - multipart/mixed content-type image data from http response

How would we parse the HTTP response if more than one image is returned in the body?

Below expression returns the 1st image. 

body('HTTP')?['$content']


Below expression  returns an object

body('HTTP')


Like

{"statusCode":200,"headers":{..},"body":{"$content-type":"...","$content":"..."},"body":{"$content-type":"...","$content":"..."},"body":{"$content-type":"...","$content":"..."}}

 


What actions/expressions would return an array/collection of $content?

 

Thanks in advance.

1 ACCEPTED SOLUTION

Accepted Solutions
Advocate II
Advocate II

Hello @v-bacao-msft  and @yashag2255 

 

Thanks for replying.

I was able to solve it. For the first glance, the response looked like it was only an object and it is.

But when I dug it further found that one of the key had the array of image data and was able to use the JSON parse on that key's value and iterate over that array.

 

It actually was like

{"statusCode":200,"headers":{..},"body":{"$content-type":"...","$content":"..."},"$multipart":[{"headers":{..},{"body":{"$content-type":"...","$content":"..."}},{"headers":{..},"body":{"$content-type":"...","$content":"..."}}]}

 

View solution in original post

3 REPLIES 3
Dual Super User II
Dual Super User II

Hey @sambel 

 

Can you share a screenshot of the flow and the error/issue you are facing. Or atleast the appropriate schema in which you are getting the HTTP resposne? if there are multiple images returned in the body, there should be an array that is already collecting that and you can iterate over it using the apply to each control on the body of the http action. 

 

If you can share the above details, we might be able to assist you better with this. 

 

Hope this Helps!

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Community Support
Community Support

 

Hi @sambel ,

 

Could you provide sample data for the HTTP response body?

If multiple images are contained in a body, it seems that an array should be used to store the data. But the response you provide seems to be in multiple objects. And the Object name is the same.

Please provide more details.

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Advocate II
Advocate II

Hello @v-bacao-msft  and @yashag2255 

 

Thanks for replying.

I was able to solve it. For the first glance, the response looked like it was only an object and it is.

But when I dug it further found that one of the key had the array of image data and was able to use the JSON parse on that key's value and iterate over that array.

 

It actually was like

{"statusCode":200,"headers":{..},"body":{"$content-type":"...","$content":"..."},"$multipart":[{"headers":{..},{"body":{"$content-type":"...","$content":"..."}},{"headers":{..},"body":{"$content-type":"...","$content":"..."}}]}

 

View solution in original post

Helpful resources

Announcements
PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Users online (6,385)