0

I need to provide a payload to 3rd party tool to retrieve the email built in marketing cloud, Payload requires an unique email id for retrieving the email. But, suppose i have a multiple emails which 3rd party needs to retrieve then we will have to provide an unique email id for all the emails, is there a way where the unique id doesn't change even if there are multiple emails? If yes, then how to achieve that? if no, then what is the alternative solution for this?

POST /guide/v1/emails/9073/dataExtension/key:0E1F0935-F10C-4950-A442-D8DC47A211EE/contacts/key:abhishek.j.mishra@test.com/preview?kind=html

HTTP/1.1

Host: www.exacttargetapis.com

Authorization: Bearer XXXXXXXXXXXXXXXXXXX

Content-Type: application/json

Cache-Control: no-cache

Postman-Token: 97eb3fd8-4d6e-9125-1340-fa9a1d5648b5

  • can you please provide your current API call or method for reference? – Gortonington May 29 '18 at 12:59
  • @Gortonington i have updated the question with the API – Abhishek May 30 '18 at 7:57
  • Thank you for that - it is really helpful, I just have one more question, are you using Classic or Content Builder for your emails? – Gortonington May 30 '18 at 11:57
  • @Gortonington content builder – Abhishek Jun 1 '18 at 6:32
0

@Abhishek by using folder CategoryID you can retrieve all emails at a time

endpoint url:https://webservice.s7.exacttarget.com/Service.asmx
headers:
 soapAction:Retrieve
 Content-Type:text/xml
  this is request

   <soapenv:Envelope 
        xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
     xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <soapenv:Header>
    <wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis- 
   open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
     <wsse:UsernameToken wsu:Id="UsernameToken-32259181" 
   xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss- 
      wssecurity-utility-1.0.xsd">
        <wsse:Username>*****</wsse:Username>
        <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis- 
        200401-wss-username-token-profile-1.0#PasswordText">***** 
      </wsse:Password>
     </wsse:UsernameToken>
     </wsse:Security>
   </soapenv:Header>
     <soapenv:Body>
     <RetrieveRequestMsg xmlns="http://exacttarget.com/wsdl/partnerAPI">
        <RetrieveRequest>
            <ObjectType>Email</ObjectType>
            <Properties>ID</Properties>
            <Properties>Name</Properties>
            <Properties>Subject</Properties>
            <Properties>Status</Properties>
            <Properties>PartnerKey</Properties>
            <Properties>CreatedDate</Properties>
            <Properties>Folder</Properties>
            <Properties>CategoryID</Properties>
            <Properties>HTMLBody</Properties>
            <Properties>CharacterSet</Properties>  

            <Properties>EmailType</Properties>

            <Filter xsi:type="SimpleFilterPart">
                <Property>CategoryID</Property>
                <SimpleOperator>equals</SimpleOperator>
                <Value>5333</Value>
            </Filter>
        </RetrieveRequest>
      </RetrieveRequestMsg>
     </soapenv:Body>
    </soapenv:Envelope>
  • is there a documentation for this? can we do it using REST API? – Abhishek May 30 '18 at 7:58
  • ya we con do it with rest api – pkharries May 30 '18 at 9:08
0

As you are utilizing Content Builder, there are a few REST API methods that are available to you. "The API uses the term asset to refer to all types of marketing content. Assets are hierarchial" (More info about Assets) The Asset Type you are looking to use is AssetTypeID 208 & Name htmlemail.

These REST API methods allow you to add simple and advanced queries to assets via Simple Operators. For the different attributes that you can query for/on, please look here.

Simple Query: /asset/v1/content/assets?$filter=Name%20like%20'hello%20world'

This will look for all assets that are similar to 'hello world'. This is good for not just getting filtered groups of emails, but will pull from all asset types unless otherwise specified

Advanced Query:

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

{
    "page":
    {
        "page":1,
        "pageSize":50
    },

    "query":
    {
        "leftOperand":
        {
            "property":"version",
            "simpleOperator":"equal",
            "value":1
        },
        "logicalOperator":"AND",
        "rightOperand":
        {
            "property":"assetType.name",
            "simpleOperator":"equal",
            "value":"Template"
        }
    },

    "sort":
    [
        { "property":"id", "direction":"ASC" }
    ],

    "fields":
    [
        "enterpriseId",
        "memberId",
        "thumbnail",
        "category",
        "content",
        "data"
    ]
}

This is good for specifying a very particular group. Say you want to have only email types returned and you want all the 'htmlpaste' and 'templatebased' emails (regardless of location) whose name begins with 'Welcome', you can easily do that via this API call and it will return all the info inside of a JSON for you to grab.

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.