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.
Solved! Go to Solution.
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":"..."}}]}
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!
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,
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":"..."}}]}
Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.
Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!
User | Count |
---|---|
16 | |
14 | |
7 | |
6 | |
5 |
User | Count |
---|---|
24 | |
18 | |
10 | |
8 | |
6 |