1

My team has recently started using Airtable to manage our projects and I would like to make it a little more efficient by cataloging our library of assets there. So I would use tables to list our data extensions, journeys, content, etc.

My thought was to use an automation to regularly run a query that would pull lists of these items and then run javascript to write them to Airtable. I know how to use Automation Studio to interact with things like data extensions, but not necessarily to list all of the ones we have.

Is this possible? Would I be better off writing my own custom API code?

1 Answer 1

4

Your best bet is to use the APIs to collect this information. Do note though that this will be at a per BU level and not an enterprise level, so you may need to do each of these multiple times to get all across each BU. You also need to verify that your count is not greater than the max page size. If so, you will need to do multiple calls to ensure you get each item.

First, you would need to use the REST API to gather an auth token - that is explained via the docs here. I also have some info on it inside of a blog post I made about setting up a SFMC instance inside POSTman that may help.

You would then use that auth token to access the below APIs.


ASSETS
You can use the REST Asset endpoint to collect your images, emails, templates, Cloudpages (only those using the Content Builder editor) etc. via the basic query endpoint:
/asset/v1/content/assets?$pagesize=450&$filter=assetType.displayName%20eq%20image

(and can change the displayName to be email for all emails. You can also change it to filter on assetType.name and use values like: templatebasedemail, webpage, etc. to collect specific type of assets.)

or you can use the Complex query version to pear down further: /asset/v1/content/assets/query


DATA EXTENSIONS
To get the data extensions, I would recommend using WSProxy (if inside SFMC) or a SOAP call if outside):

    var prox = new Script.Util.WSProxy();
    var cols = ["Name","CustomerKey","CategoryID","IsSendable"];
    var filter = {
        Property: "{{example}}",
        SimpleOperator: "equals",
        Value: "{{example}}"
    };
    var desc = prox.retrieve("DataExtension", cols, filter);

SOAP:

      <RetrieveRequestMsg xmlns="http://exacttarget.com/wsdl/partnerAPI">
           <RetrieveRequest>
              <ObjectType>DataExtension</ObjectType>
              <Properties>CustomerKey</Properties>
              <Properties>Name</Properties>
              <Properties>ModifiedDate</Properties>
              <Properties>CategoryID</Properties>
              <Properties>Status</Properties>
                <Filter xsi:type="ns1:SimpleFilterPart" xmlns:ns1="http://exacttarget.com/wsdl/partnerAPI">
               <Property>{{example}}</Property>
               <SimpleOperator>equals</SimpleOperator>
               <Value>{{example}}</Value>
            </Filter> 
           </RetrieveRequest>
        </RetrieveRequestMsg>

I placed an example filter in there, but it is not necessary to retrieve it. You can change the returned fields to ensure you get the right data back.

To parse through the response, you will use array and object parsing in JS:
var deName = desc.Results[0].Name;

To check if the return has more records, you will want to look for the 'HasMoreRows' field. True is that there are more rows that you need to pull (count > max Page size). Here is a good example from docs on how to handle that.


AUTOMATIONS
I wrote a blog post on creating an Automation Dashboard that you can repurpose for your needs. But I would look to utilize WSProxy or the SOAP API to get the basic information like below:

<script runat="server">

Platform.Load("Core","1.1.1");

  var prox = new Script.Util.WSProxy();

  var cols = ["Name","Status"];
  var filter = {
      Property: "Status",
      SimpleOperator: "IN",
      Value: [-1,0,1,2,3,4,5,6,7,8]
  };
  var res = prox.retrieve("Automation", cols, filter);

</script>

SOAP:

      <RetrieveRequestMsg xmlns="http://exacttarget.com/wsdl/partnerAPI">
      <RetrieveRequest>
            <ObjectType>Automation</ObjectType>
            <Properties>*</Properties>
            <Filter xsi:type="SimpleFilterPart">
                <Property>Status</Property>
                <SimpleOperator>IN</SimpleOperator>
                <Value>-1</Value>
                <Value>-0</Value>
                <Value>1</Value>
                <Value>2</Value>
                <Value>3</Value>
                <Value>4</Value>
                <Value>5</Value>
                <Value>6</Value>
                <Value>7</Value>
                <Value>8</Value>
            </Filter>
         </RetrieveRequest>
   </RetrieveRequestMsg>

(you will notice inside the SOAP we are able to use the * wildcard to return all properties. This can also be used inside WSProxy I believe [not 100%, but I think so] but it may be more efficient to just list out the specific properties you need.)


JOURNEYS
For these, you will need another REST API endpoint. You would want to use the endpoint:
/interaction/v1/interactions

This will return a list of all of your journeys (again look at maxpagesize to ensure all are returned and additional calls are not necessary).


Again, as stated above, the APIs are the best way to collect this. And to that point, I would look to have an outside system make and parse these calls instead of utilizing internally via SFMC. The reasoning behind this is that SFMC was not designed for this type of repeatable process-heavy actions and your scripts may fall over or cause huge delays or slow downs in your instance.

1
  • 1
    You, sir, provide the most comprehensive answers on this site :-) Commented Mar 19, 2020 at 16:32

You must log in to answer this question.

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