3

Has anyone uploaded a PDF to Content Builder using REST? I think this is the Route, just not sure exactly how it works.

POST /asset/v1/content/assets

I see a few properties:

Data    object      Property bag containing the asset data
Content string      The actual content of the asset

Looking to upload the PDF in Content Builder for use as an Email Attachment.

1 Answer 1

9

As per your post I was able to upload a pdf file into sfmc content builder. It took me a little while to gather all the necessary attributes but it is all available in REST Reference API.

Here are the steps and things to consider:

  • Make sure the API user account has Assets read and write access.
  • Your pdf file that needs to be uploaded to the content builder needs to be Base64Encoded which you can convert using this website.
  • If you wish to upload the pdf file to a specific folder within content builder then you need to specify the folder ID and name within the category object attribute.
  • Also proper assetType needs to be set for specific type of file - in your situation it is name as pdf and id as 127.
  • Also I am using Postman to test this scenario.

  • Below is the sample request which works successfully:

Header

Body

{ "name": "pdf name to be uploaded", "assetType": { "name": "pdf", "id": 127 }, "category": { "id": 123456 (ID of the folder) , "name": "name of folder where pdf is uploaded" }, "file": "xxxxxBase64Encoded-Filexxxxx" }

3
  • On an unrelated note: for id/name attributes like assetType and category, only the id is required. The name is useful for display purposes on GET but will be ignored on POST/PUT/PATCH. Commented Oct 30, 2017 at 13:21
  • Thank you for your response. I was able to successfully add a file. Commented Oct 30, 2017 at 19:24
  • Just a friendly comment, you don't need to pass category name is the payload as id is all you need
    – tkhuynh
    Commented Mar 2, 2018 at 20:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .