Using the REST API I am trying to extract the HTML content of an email.

Endpoint URL : https://SUBDOMAIN.rest.marketingcloudapis.com/asset/v1/content/assets/{{asset_id}}

The above URL returns a response. From that response, I am trying to extract only the content field.

For which the example path would look like : var content =response.items[0].views.html.slots.zz10o1b7kxe.blocks. ezu99xmqaa4.content

 "slots": {
                            "zz10o1b7kxe": {
                                "locked": false,
                                "content": "<div data-type=\"block\" data-key=\"ezuooxmqaa4\"></div>",
                                "design": "<p style=\"font-family: arial; color: #CCCCCC; font-size: 12px; font-weight: bold; text-align: center; display: flex; flex-direction: column; justify-content: center; height: 150px; padding: 10px; margin: 0; border: 1px dashed #CCCCCC;\">INPUT DATA FOR EMAIL</p>",
                                "availableViews": [],
                                "blocks": {
                                    "ezu99xmqaa4": {
                                        "assetType": {
                                            "id": 220,
                                            "name": "codesnippetblock"
                                        "content": "<html><body><p>some content</p></body></html>" 

The issue is that in order to fetch the HTML content I need to pass slot_id & block_id - zz10o1b7kxe & ezu99xmqaa4, which are different for different assets. How can I access the HTML content for different assets as these 2 values changes?


Your Answer

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

Browse other questions tagged or ask your own question.