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

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

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

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

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

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 Team
Community Support Team

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

 

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

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

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
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 Kudoed Authors (Last 30 Days)
Users online (5,460)