Create File REST API | Community
Skip to main content
August 13, 2015
Question

Create File REST API

  • August 13, 2015
  • 2 replies
  • 1722 views

Hello

I was just curious if anyone has used Marketo REST API to Create a File? It's under - Create a File » Marketo Developers.

I have gone through the examples and trying to upload an Image file (PNG) via this API using Python (2.7). But no success! I am getting this error message -

u'errors': [{u'message': u'name is mandatory', u'code': u'701'}, {u'message': u'file is mandatory', u'code': u'701'}

The Java example uses boundary but I am trying to implement this in Python without any boundary. Hope that makes sense!

The issue is somehow I am the "name" and "file" is not getting passed through even though I am sending them over. Looked up online and found useful hints but somehow nothing has worked so far .

Any idea?

On the side note - can someone confirm if the PHP example mentioned on that API page works?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

2 replies

SanfordWhiteman
Level 10
August 13, 2015

multipart/form-data always has a boundary.  That's how the MIME parts are separated.

Kenny_Elkington
Adobe Employee
Adobe Employee
August 13, 2015

Sanford is correct, the boundary is part of the multipart/form-data content type.  The RFC is here: http://www.ietf.org/rfc/rfc2388.txt  ​ I highly recommend finding a library or framework that can handle the encoding for you as the standard is very frustrating to work with.

For the PHP, yes it works, though CURLFile is PHP 5.5=<.  You need to use the old @file notation for older versions when using libcurl.