0

Please can anyone suggest how to retrieve email Id for an email in MC using Rest API

Regards, Shiva

  • 1
    Can you be more descriptive about your requirement. – Vishal Kumar C V Nov 7 '19 at 11:57
  • HI Vishal,I know the email names that are present in MC ,i want to pull their email ID through rest api scripting – shiva dn Nov 7 '19 at 12:29
0

You can use the REST endpoint of /asset/v1/content/assets?$filter=Name%20eq%20'{{emailName}}' (ref)

This will pull back a full response of details on that email (asset) which includes the ID (both the legacyID and Content Builder ID).

Example Return: (Abbreviated for easier digestion)

{
    "count": 1,
    "page": 1,
    "pageSize": 50,
    "links": {},
    "items": [
        {
            "id": XXXXX,
            "customerKey": "XXXXXXXXXXXXXXXXXXXXXXX",
            "objectID": "XXXXXXXXXXXXXXXXXXXXXX",
            "contentType": "application/vnd.etmc.email.Message; kind=template",
            "assetType": {
                "id": 207,
                "name": "templatebasedemail",
                "displayName": "Template-Based Email"
            },
            "name": "emailName",
            "description": "",
            .....
            "thumbnail": {
                "thumbnailUrl": "/v1/assets/{{emailID}}/thumbnail"
            },
            "category": {
                "id": XXXXX,
                "name": "Content Builder",
                "parentId": 0
            },
            .....
            "legacyData": {
                "legacyId": XXXXX,
                "legacyKey": "XXXXXXXXXXXXXXXXXXXX",
                "legacyType": "email",
                "legacyCategoryId": XXXXX
            },
            "modelVersion": 2
        }
    ]
}

Now keep in mind this will return any asset with that name, so if you have a content block and email with the same name, it will return both.

If you need more specific filters, you can use /asset/v1/content/assets/query which will allow you to put more complex filters inside of a payload. (ref)

  • Thanks Gortonington for advice – shiva dn Nov 8 '19 at 7:38

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