Unfortunately, this REST API endpoint does not return Text-version Content but only HTML-version:
Host: https://YOUR_SUBDOMAIN.rest.marketingcloudapis.com
GET /asset/v1/content/assets/
Content-Type: application/json
Authorization: Bearer YOUR_ACCESS_TOKEN
I've tried it with different emails and filters, yet this path: "items": { views": { "text": { "content": } } }
was always empty.
However, you can do a preview of your email with this REST endpoint, considering that you have a Data Extension with a record suitable for preview, which will always correctly render an email:
Host: https://YOUR_SUBDOMAIN.rest.marketingcloudapis.com
POST /guide/v1/emails/{Email_ID}/dataExtension/{DE_ObjectId}/row/{Row_Number}/preview
Content-Type: application/json
Authorization: Bearer YOUR_ACCESS_TOKEN
- Email_ID - just retrieve from UI
- DE_ObjectID - millions of ways of getting it through scripts and API, the fastest IMHO would be to pick it from HTML when Inspecting Element inside the folder where DE is located:
- Row_Number - just exactly what it means, would be easier to have only one record in the case with a dedicated Data Extension for preview
As a result, you will have a response with that two ContentTypes where each will contain in the Content property needed information:
{
"contentType": "vnd.exacttarget.message.email.subjectLine",
"content": "xxx"
},
{
"contentType": "vnd.exacttarget.message.email.textBody",
"content": "xxx"
}
Lastly, please consider that this is the undocumented endpoint and is not officially supported by SFMC. The endpoint could be changed or removed whenever and thus use it at your own risk.