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><a href="https://getridbug.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="bbc8d2d6d4d5fbc8dacec8dadcde95d8d4d6">[email protected]</a></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>
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
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><a href="https://getridbug.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="7a090a08131d1d091b3a1e131d130e1b161f0c54191517">[email protected]</a></EmailAddress> <Attributes> <Name>Email Address</Name> <Value><a href="https://getridbug.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="b2c1c2c0dbd5d5c1d3f2d6dbd5dbc6d3ded7c49cd1dddf">[email protected]</a></Value> </Attributes> <SubscriberKey><a href="https://getridbug.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="9effedeeecf7f9f9eddefafbf9faf7f9f7eafff2b0fdf1f3">[email protected]</a></SubscriberKey> </Objects> </UpdateRequest> </s:Body> </s:Envelope>
Method 2
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><a href="https://getridbug.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="2a5945474f4f474b43466a4f474b434604494547">[email protected]</a></EmailAddress> <Lists> <ID>3899</ID> <ListClassification>PublicationList</ListClassification> <Status>Active</Status> <ObjectID xsi:nil="true"></ObjectID> </Lists> </Objects> </CreateRequest> </s:Body> </s:Envelope>
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0