SOLVED

Re: uploading an image through Marketo API into Design Studio: 611 System Error

Go to solution
JayW
Level 2

uploading an image through Marketo API into Design Studio: 611 System Error

I am trying to get the teams to upload the image via a Microsoft Form, and through a PowerAutomate flow, I am trying to do an HTTP request to upload that file into Marketo.
I managed to get the file content as base64 string. 
And here is my API request.

JayW_0-1694646239631.png

Here's the body of the API request.

--------WebKitFormBoundary2VyWOacQSupl4gUL
Content-Disposition: form-data; name="name"
Golden Age Banner_Dhananjaya Walallawi.jpg
--------WebKitFormBoundary2VyWOacQSupl4gUL
Content-Disposition: form-data; name="folder"
{ "id":804, "type":"Folder" }
--------WebKitFormBoundary2VyWOacQSupl4gUL
Content-Disposition: form-data; name="description"
This is a test file
--------WebKitFormBoundary2VyWOacQSupl4gUL--
Content-Disposition: form-data; name="file"; filename="Golden Age Banner_Dhananjaya Walallawi.jpg"
Content-Type: image/jpeg
@{outputs('Compose')}
--------WebKitFormBoundary2VyWOacQSupl4gUL--

I keep getting the 611 system error.
Any idea what I've got wrong here? It's my first time trying to use this API call.

1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: uploading an image through Marketo API into Design Studio: 611 System Error

Well, that’s clearly an invalid multipart/form-data payload. (Whether you copied it from the docs or not!)

 

multipart/form-data always has two line breaks after the header of each part. Yours has one. And the next-to-last boundary is formed incorrectly.

 

An example of a valid payload, where [binary data here] is your binary — not Base64-encoded, raw binary — data:

--------WebKitFormBoundary2VyWOacQSupl4gUL
Content-Disposition: form-data; name="name"

Golden Age Banner_Dhananjaya Walallawi.jpg
--------WebKitFormBoundary2VyWOacQSupl4gUL
Content-Disposition: form-data; name="folder"

{ "id":11357, "type":"Folder" }
--------WebKitFormBoundary2VyWOacQSupl4gUL
Content-Disposition: form-data; name="description"

This is a test file
--------WebKitFormBoundary2VyWOacQSupl4gUL
Content-Disposition: form-data; name="file"; filename="Golden Age Banner_Dhananjaya Walallawi.jpg"
Content-Type: image/png

[binary data here]
--------WebKitFormBoundary2VyWOacQSupl4gUL--

 

View solution in original post

4 REPLIES 4
Jo_Pitts1
Level 10 - Community Advisor

Re: uploading an image through Marketo API into Design Studio: 611 System Error

@JayW , how big is the image.  I worked on a project a while ago where large images caused problems.

Frustratingly, these same images could be uploaded through the UI.

 

 

SanfordWhiteman
Level 10 - Community Moderator

Re: uploading an image through Marketo API into Design Studio: 611 System Error

Well, that’s clearly an invalid multipart/form-data payload. (Whether you copied it from the docs or not!)

 

multipart/form-data always has two line breaks after the header of each part. Yours has one. And the next-to-last boundary is formed incorrectly.

 

An example of a valid payload, where [binary data here] is your binary — not Base64-encoded, raw binary — data:

--------WebKitFormBoundary2VyWOacQSupl4gUL
Content-Disposition: form-data; name="name"

Golden Age Banner_Dhananjaya Walallawi.jpg
--------WebKitFormBoundary2VyWOacQSupl4gUL
Content-Disposition: form-data; name="folder"

{ "id":11357, "type":"Folder" }
--------WebKitFormBoundary2VyWOacQSupl4gUL
Content-Disposition: form-data; name="description"

This is a test file
--------WebKitFormBoundary2VyWOacQSupl4gUL
Content-Disposition: form-data; name="file"; filename="Golden Age Banner_Dhananjaya Walallawi.jpg"
Content-Type: image/png

[binary data here]
--------WebKitFormBoundary2VyWOacQSupl4gUL--

 

JayW
Level 2

Re: uploading an image through Marketo API into Design Studio: 611 System Error

Thanks for the help @SanfordWhiteman but I still get the 611 system error.
Attached is the input call.

JayW_0-1694724490504.png

 

 

 

 

JayW_0-1694724330195.png

Am I at least close to getting this right? Is there any documentation (other than the not-so-helpful Marketo documentation on this) that I can read to learn more about this? 

SanfordWhiteman
Level 10 - Community Moderator

Re: uploading an image through Marketo API into Design Studio: 611 System Error

Not sure what you want us to do with that payload — it’s obviously not the real payload but a JSON representation in another app. It does look like you’re sending Base64-encoded binary (otherwise, it wouldn’t be human-readable at all). That’s not right, the image data needs to be the actual binary bytes.

 


Is there any documentation (other than the not-so-helpful Marketo documentation on this) that I can read to learn more about this? 

There’s always the RFC. It’s a very standard format, same one sent by multipart/form-data forms. (In fact, you can post images from a vanilla HTML form directly to the REST API for this reason. Obviously not something you’d ever publish to the outside world but you can use it to play around. Include the access_token as a query param.)