Files

Files Endpoint Reference

Marketo subscriptions allow for storage of arbitrary files like images, scripts, documents, and stylesheets.  All of these can be worked with remotely via the REST API.  Note that the storage available in Marketo subscriptions is not optimized for bandwidth-intensive applications, so alternatives should be used for proper audio and video streaming applications.

Query

Querying files is simple and follows the standard query types for assets of by id, by name, and browsing.

By Id

By Name

Specify the name of the file using the required “name” parameter.

Browse

There are three optional parameters:

  • folder – parent folder specified as JSON block containing “id” and “type” attributes
  • offset – integer that specifies where to begin retrieving entries (default is 0); can be used in conjunction with maxReturn parameter
  • maxReturn – integer that specifies the maximum number of entries to return (default is 20, maximum is 200)

Create and Update

Creating a file is done with a multipart/form-data type of request.  Minimally, the name, folder, and file are required in the request, with an optional description, and an insertOnly flag, which prevents a create call from updating an existing file with the same name.  For the file parameter, a “filename” is required in the Content-Disposition header, in addition to the name parameter.  You must also pass a Content-Type header for file, which will be the MIME-type which Marketo will use to serve the file with.

Updating a file can be done based on its id.  The only parameter is a file parameter which has the same requirements as creation.