1

I am trying to figure out how to use the SOAP API to update an existing Marketing Cloud subscriber's email address. I've tried different permutations of the below request (with Create and Update action) and although the response is successful, it does not update the record.

In the example below, my All Subscribers list as the id 52.

Please can someone check?

<SOAP-ENV:Envelope
    xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:ns1="http://exacttarget.com/wsdl/partnerAPI"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <SOAP-ENV:Header>
        <fueloauth
            xmlns="http://exacttarget.com">77fMQroSJGVTIvmiOCxCuNWF
        </fueloauth>
    </SOAP-ENV:Header>
    <SOAP-ENV:Body>
        <ns1:UpdateRequest>
            <Options>
                <SaveOptions>
                    <SaveOption>
                        <PropertyName>*</PropertyName>
                        <SaveAction>UpdateAdd</SaveAction>
                    </SaveOption>
                </SaveOptions>
            </Options>
            <ns1:Objects xsi:type="ns1:Subscriber">
                <ns1:Attributes>
                    <ns1:Name>EmailAddress</ns1:Name>
                    <ns1:Value>[email protected]</ns1:Value>
                </ns1:Attributes>
                <ns1:SubscriberKey>1234</ns1:SubscriberKey>
                <ns1:Lists>
                    <PartnerKey xsi:nil="true"/>
                    <ObjectID xsi:nil="true"/>
                    <ns1:ID>52</ns1:ID>
                </ns1:Lists>
            </ns1:Objects>
        </ns1:UpdateRequest>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

2 Answers 2

2

I was able to get it to work with this SOAP envelope -- without specifying the Lists:

<?xml version="1.0" encoding="UTF-8"?>
<s:Envelope>
   <s:Header>
      <!-- REMOVED -->
   </s:Header>
   <s:Body>
      <UpdateRequest>
         <Options>
            <Client>
               <ID><!-- MID GOES HERE --></ID>
            </Client>
            <SaveOptions>
               <SaveOption>
                  <PropertyName>*</PropertyName>
                  <SaveAction>UpdateOnly</SaveAction>
               </SaveOption>
            </SaveOptions>
         </Options>
         <Objects xsi:type="Subscriber">
            <Client>
               <ID><!-- MID GOES HERE --></ID>
            </Client>
            <PartnerKey xsi:nil="true" />
            <ObjectID xsi:nil="true" />
            <EmailAddress>[email protected]</EmailAddress>
            <Attributes>
               <Name>Email Address</Name>
               <Value>[email protected]</Value>
            </Attributes>
            <SubscriberKey>[email protected]</SubscriberKey>
         </Objects>
      </UpdateRequest>
   </s:Body>
</s:Envelope>
4
  • 2
    Hi Adam, that worked, thanks. I've simplified this somewhat as it turns out you don't necessarily require an MID (even if you have multiple BUs on the account). Here's a gist with an updated method. Commented Nov 18, 2015 at 21:11
  • @Adam Spriggs, I'm using the same SOAP envolope to update the subscriber status to "Unsubscribe", the response return OK,200 but when I see the UI it does not update the status of the subscriber. Can you help me with this? Commented Nov 27, 2020 at 7:55
  • @JiteshGoel you should log an unsub event if you're trying to unsubscribe a subscriber. Commented Nov 27, 2020 at 13:15
  • @AdamSpriggs , Im unsubscribing the subscriber from a Third Psrty(Salesforce in our case). How can we use from there? Commented Nov 30, 2020 at 14:44
1

If you need to update a List (or Publication List) in the Lists tag take into consideration that the ID accepts an integer, i.e. 3899 not 3899_HTML

<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
    <s:Header>
        <a:Action s:mustUnderstand="1">Create</a:Action>
        <a:MessageID>urn:uuid:7e0cca04-57bd-4481-864c-6ea8039d2ea0</a:MessageID>
        <a:To s:mustUnderstand="1">https://<<YOUR INSTANCE>>.soap.marketingcloudapis.com/Service.asmx</a:To>
        <fueloauth xmlns="http://exacttarget.com">your_access_token</fueloauth>
    </s:Header>
    <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
        <CreateRequest xmlns="http://exacttarget.com/wsdl/partnerAPI">
             <Options>
                <SaveOptions>
                   <SaveOption>
                      <PropertyName>*</PropertyName>
                      <SaveAction>UpdateOnly</SaveAction>
                   </SaveOption>
                </SaveOptions>
             </Options>
             <Objects xsi:type="Subscriber">
                <ObjectID xsi:nil="true"></ObjectID>
                <SubscriberKey>XPTO</SubscriberKey>
                <EmailAddress>[email protected]</EmailAddress>
                <Lists>
                   <ID>3899</ID>
                   <ListClassification>PublicationList</ListClassification>
                   <Status>Active</Status>
                   <ObjectID xsi:nil="true"></ObjectID>
                </Lists>
             </Objects>
        </CreateRequest>
    </s:Body>
</s:Envelope>

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .