3

I'm trying to identify all the places a Content Block is used. The goal is to be able to reference what will be affected if a Content Block is modified.

I've looked a the Asset in the REST API, but I don't see a reference to where it's used???

  • As far as I know there's no way to do that. However, this reference would be extremely helpful. Unfortunately it is close to impossible to get a marketing cloud idea above the points threshold for product development consideration. At the moment there's not even an idea for this in the success community... – Stephan de Paly Mar 28 at 21:55
  • I know it IS possible and have seen it in custom built tools, but I imagine it is a very complex and process heavy task - especially if you have a significant amount of assets in your account. – Gortonington Mar 29 at 12:54
0

You can use the Content Builder REST API to retrieve the content block from Content Builder.

https://www.exacttargetapis.com/asset/v1/content/assets/{id}
GET /asset/v1/content/assets/{id} 
Content-Type: application/json
Authorization: Bearer YOUR_ACCESS_TOKEN

If that doesn't work. You can try filtering by the Asset Type where the Base AssetTypeID of a Content Block is 3.

Or drill down to the exact type of block.

  • htmlblock has an AssetTypeID of 197
  • codesnippetblock has an AssetTypeID of 220
  • etc.

Use the Advanced Query API call with a payload of something like this:

    https://www.exacttargetapis.com//asset/v1/content/assets/query
    POST /asset/v1/content/assets/query 
    Content-Type: application/json
    Authorization: Bearer YOUR_ACCESS_TOKEN

    {
        "query": {

                "property":"assetType:id",
                "simpleOperator":"equals",
                "valueType":"int",
                "value":"197"
        }
    }

If you want to widen the net, you can use the same Advanced Query to filter assets using the in operator to identify where that content block is being used:

Value is among the list of values. Use this operator to retrieve a list of assets by their IDs, or a list of assets by nearly any enumerable value.

  • 1
    But the Assets route doesn't tell me where it's used. I'm looking for a way to say Content Block A is used in Email 1, Email 4, and Email 7, etc – victorcorey Mar 31 at 16:22
0

Having put research into this, there is a way to do it, but as I said in my comment it is very process heavy.

Basically what you would do is

  1. Get the ID of the content block you want to find
  2. Run a query asset GET using ?$filter=AssetType.id%20eq%20'207' (this is template email asset id) or use advanced query if you have more then one filter.
  3. Parse the returned Json via a few FOR loops to find your contentblock ID using something like html.slots[i].blocks[a].id = 8675309 with both i and a being variables from a FOR loop sifting through each sub object. The reason you need to do this is that inside each email, the slots and blocks are 'named' differently so you are unable to properly sift through them without using an iterable for loop.
  4. You then can return the name of the corresponding email if the condition is met and that list should contain all the ones that use your content block.

I have to assume there must be a less process heavy way, but from my research this is the best I have been able to find.

The caveat on this is that I do not believe it will be able to grab anything that is pulled via AMPScript functions or if it exists in Cloudpages.

For AMPscript functions, you could explore each of the HTML objects in both template and html emails to find the id/name/customerkey references, but that is even more complex and process heavy.

I do not know of a way currently to retrieve Cloudpages via API. There is an id of 205 that is labeled as webpage but I have had no luck at all trying to retrieve from it - which could partially be that I didn't have much time to get into it too far. It is definitely worth exploring if you have the inkling to.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.