0

I am digging into Marketing Cloud documentation and can't find anything about how to retrieve all categories or create a category with REST API call. Can anyone point me to a right direction or document? I don't want to believe that MC does not provide this functionality.

2 Answers 2

1

You can't retrieve Data Folders with REST, as far as I'm aware. You can retrieve Content Builder folders with the SOAP API:

Request

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Header>
      <wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
         <wsse:UsernameToken wsu:Id="UsernameToken-24440876" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
            <wsse:Username>{{Username}}</wsse:Username>
            <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">{{Password}}</wsse:Password>
         </wsse:UsernameToken>
      </wsse:Security>
   </soapenv:Header>
   <soapenv:Body>
      <RetrieveRequestMsg xmlns="http://exacttarget.com/wsdl/partnerAPI">
         <RetrieveRequest>
            <ClientIDs><ID>123456</ID></ClientIDs>
            <ObjectType>DataFolder</ObjectType>
            <Properties>Client.ID</Properties>
            <Properties>Name</Properties>
            <Properties>ID</Properties>
            <Properties>Description</Properties>
            <Properties>ContentType</Properties>
            <Properties>IsActive</Properties>
            <Properties>IsEditable</Properties>
            <Properties>AllowChildren</Properties>
            <Properties>CreatedDate</Properties>
            <Properties>ModifiedDate</Properties>
            <Properties>ObjectID</Properties>
            <Properties>CustomerKey</Properties>
            <Properties>ParentFolder.ID</Properties>
            <Properties>ParentFolder.CustomerKey</Properties>
            <Properties>ParentFolder.ObjectID</Properties>
            <Properties>ParentFolder.Name</Properties>
            <Properties>ParentFolder.Description</Properties>
            <Properties>ParentFolder.ContentType</Properties>
            <Properties>ParentFolder.IsActive</Properties>
            <Properties>ParentFolder.IsEditable</Properties>
            <Properties>ParentFolder.AllowChildren</Properties>
             <Filter xsi:type="par:SimpleFilterPart" xmlns:par="http://exacttarget.com/wsdl/partnerAPI">
                  <Property>ContentType</Property>
                  <SimpleOperator>equals</SimpleOperator>
                  <Value>asset</Value>
            </Filter>
         </RetrieveRequest>
      </RetrieveRequestMsg>
   </soapenv:Body>
</soapenv:Envelope>

Response

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
    <soap:Header>
        <wsa:Action>RetrieveResponse</wsa:Action>
        <wsa:MessageID>urn:uuid:cbdab5ad-eebf-4cf9-9dd5-76a1239d91c1</wsa:MessageID>
        <wsa:RelatesTo>urn:uuid:b7ff3756-800c-4b6a-ae90-0f44a0e9bf64</wsa:RelatesTo>
        <wsa:To>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:To>
        <wsse:Security>
            <wsu:Timestamp wsu:Id="Timestamp-a1b7863c-3361-4f75-a5ec-815a5aaf9c73">
                <wsu:Created>2017-05-31T10:57:32Z</wsu:Created>
                <wsu:Expires>2017-05-31T11:02:32Z</wsu:Expires>
            </wsu:Timestamp>
        </wsse:Security>
    </soap:Header>
    <soap:Body>
        <RetrieveResponseMsg xmlns="http://exacttarget.com/wsdl/partnerAPI">
            <OverallStatus>OK</OverallStatus>
            <RequestID>3ac85269-bb82-4120-ad29-d99d1e16198e</RequestID>
            <Results xsi:type="DataFolder">
                <Client>
                    <ID>123456</ID>
                </Client>
                <PartnerKey xsi:nil="true" />
                <CreatedDate>2016-11-13T18:22:33.687</CreatedDate>
                <ModifiedDate>2016-11-13T18:22:33.687</ModifiedDate>
                <ID>854614</ID>
                <ObjectID>96e360d4-d3e5-44cc-824f-48fce94244f9</ObjectID>
                <CustomerKey />
                <ParentFolder>
                    <PartnerKey xsi:nil="true" />
                    <ID>0</ID>
                    <ObjectID xsi:nil="true" />
                </ParentFolder>
                <Name>Content Builder</Name>
                <Description>The root folder for assets</Description>
                <ContentType>asset</ContentType>
                <IsActive>true</IsActive>
                <IsEditable>false</IsEditable>
                <AllowChildren>true</AllowChildren>
            </Results>
            <Results xsi:type="DataFolder">
                <Client>
                    <ID>123456</ID>
                </Client>
                <PartnerKey xsi:nil="true" />
                <CreatedDate>2017-05-31T04:54:43.067</CreatedDate>
                <ModifiedDate>2017-05-31T04:54:43.067</ModifiedDate>
                <ID>871130</ID>
                <ObjectID>0bdd2141-1562-4629-9969-85509d1099a1</ObjectID>
                <CustomerKey />
                <ParentFolder>
                    <PartnerKey xsi:nil="true" />
                    <ID>854614</ID>
                    <ObjectID>96e360d4-d3e5-44cc-824f-48fce94244f9</ObjectID>
                    <Name>Content Builder</Name>
                    <Description>The root folder for assets</Description>
                    <ContentType>asset</ContentType>
                    <IsActive>true</IsActive>
                    <IsEditable>false</IsEditable>
                    <AllowChildren>true</AllowChildren>
                </ParentFolder>
                <Name>Sub Folder</Name>
                <Description />
                <ContentType>asset</ContentType>
                <IsActive>true</IsActive>
                <IsEditable>true</IsEditable>
                <AllowChildren>true</AllowChildren>
            </Results>
        </RetrieveResponseMsg>
    </soap:Body>
</soap:Envelope>
2
  • Hi Andrew thanks for your response. Unfortunately using soap does not get the folders/categories. I get some folders under my content but these are not the same as under content builder. It seems (I assume) with content builder, the folders are actually categories that are saved in the database which is different from classic content folder.
    – A.G.
    Jun 1, 2017 at 16:21
  • 1
    Hi @A.G. Sorry. Maybe I'm misunderstanding your question. Folders (called "DataFolders" in the API) are retrieved and created in the same way through the API whether they're Content Builder or Classic Content folders. The difference being Content Builder folders/categories have a DataType of "asset" - see above SOAP response. Are you referring to some other categorisation of content?
    – Macca
    Jun 2, 2017 at 0:36
1

It seems MC DEV team added a new API method to retrieve a list of asset categories. Here is the documentation, ignore the description that says "Gets an asset collection"

You must log in to answer this question.

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