Skip to main content
Community site session details

Community site session details

Session Id : cozMImXDeDiMQEXuSWS1mc
Power Automate - Building Flows
Unanswered

HTTP Post API Call with Image Content Payload

Like (0) ShareShare
ReportReport
Posted on 20 Dec 2020 07:22:58 by

I am working on a Flow to automate image uploads to Square, who provides an API to create catalog images. My current process saves JPEGs to OneDrive and then utilizes the API to post the content to Square. However, this fails with a 400 Bad Request status from the API call - I could certainly be building the HTTP message incorrectly for use with their API, but I think it is correct, so I'm wondering if I am not properly handling the File Content for the image.

 

Any thoughts on 1) handling the file content or 2) HTTP header/body content?

 

Flow Actions:

image.png

image.png

 

 

Example failure:

image.png

image.png

image.png

 

{
 "$content-type": "multipart/form-data",
 "$multipart": [
 {
 "headers": {
 "Content-Disposition": "form-data; name=\"file\"; filename=\"9781452172187-L.jpg\""
 },
 "body": {
 "$content-type": "image/jpeg",
 "$content": ""
 }
 },
 {
 "headers": {
 "Content-Disposition": "application/json"
 },
 "body": {
 "idempotency_key": "39008122-ce15-490c-9ee2-936f18c014b6",
 "image": {
 "id": "#9781452172187",
 "type": "IMAGE",
 "image_data": {
 "caption": "ISBN 9781452172187"
 }
 }
 }
 }
 ]
}

 

 

 

 

 

Thanks for any help.

  • MJain Profile Picture
    2,450 on 22 Dec 2020 at 14:54:10
    Re: HTTP Post API Call with Image Content Payload

    Hi @Kismet ,

     

    Have you tried doing the same via Postman , if so there is a button at the top right to show code of the request. You can click on it and decide which programming language you want to view the output.  All you need is to grab the same request and paste in the HTTP post call you are making in flow.

     

    Thanks

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 2

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 2

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 2

Loading complete