Add Image CMS Content to Marketing Cloud
Use the Marketing Cloud API’s content assets resource to add image CMS content to Marketing Cloud in a connected app. If the request is successful, the content is then available in Content Builder.
To form the API request, you need these items.
- A Marketing Cloud access token
- The Base64-encoded image downloaded from CMS that you want to import to Marketing Cloud
- The category ID of the folder in Content Builder where you want Marketing Cloud to save the image
To send an API call to add an image to Marketing Cloud, make an HTTP POST request to the /asset/v1/content/assets
resource.
Include an Authorization header with the value Bearer {access_token}
, where access_token is your CMS access token.
In the request body, create a JSON object with these fields.
-
name
—A string that contains the name of the image. -
assetType
—An object containing theid
field with a value that matches the asset type of the image format, such as GIF or JPEG. For a list of possible types, see Marketing Cloud API: List of Asset Types. -
file
—A string that contains the Base64-encoded image. -
category
—An object that contains theid
field with a string value. Set the value to the category ID of the Content Builder folder where you want Marketing Cloud to save the image.
For more information on the request and response format for this resource, see Marketing Cloud API: REST API v1 Reference.
This Node.js sample downloads an image file from CMS and then adds the image to Marketing Cloud. The currentNode
object contains the CMS content.
In response to the API request, the API returns an HTTP response code and a JSON body with an object representing the newly created asset in Marketing Cloud. For details on the response object and possible HTTP response codes, see Marketing Cloud API: REST API v1 Reference.