2

I am trying to re-activate a subscriber, who I have previously unsubscribed using LogUnsubEvent from the 'All Subscribers' list.

enter image description here

To do this I am trying to update the Subscriber's Status field, using the Fuel SDK and PHP:

$obj = new ET_Subscriber();
$obj->authStub = $etClient;
// Have also tried SubscriberKey
$obj->props = ['Status' => 'Active', 'EmailAddress' => 'foo@example.com'];
$result = $obj->patch();

The result is:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
   <soap:Header>
      <wsa:Action>UpdateResponse</wsa:Action>
      <wsa:MessageID>urn:uuid:a9733b8e-e87a-43c6-b09d-c594ce3568f5</wsa:MessageID>
      <wsa:RelatesTo>urn:uuid:96226130-a985-4baa-bf8e-efb9a513d757</wsa:RelatesTo>
      <wsa:To>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:To>
      <wsse:Security>
         <wsu:Timestamp wsu:Id="Timestamp-b6608242-90fe-41fe-b715-2621c084f921">
            <wsu:Created>2018-05-10T17:07:56Z</wsu:Created>
            <wsu:Expires>2018-05-10T17:12:56Z</wsu:Expires>
         </wsu:Timestamp>
      </wsse:Security>
   </soap:Header>
   <soap:Body>
      <UpdateResponse xmlns="http://exacttarget.com/wsdl/partnerAPI">
         <Results>
            <StatusCode>Error</StatusCode>
            <StatusMessage>API Permission Failed.</StatusMessage>
            <OrdinalID>0</OrdinalID>
            <ErrorCode>7</ErrorCode>
         </Results>
         <RequestID>2389de99-06c2-40cf-97e2-13aa6b3ea30c</RequestID>
         <OverallStatus>Error</OverallStatus>
      </UpdateResponse>
   </soap:Body>
</soap:Envelope>

As far as I know this API user has the full permissions. It unsubscribes without issue. How should I resubscribe a person?

Fuel SDK's generated request is:

<?xml version="1.0" encoding="UTF-8"?>
<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>
        <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" SOAP-ENV:mustUnderstand="1">
            <wsse:UsernameToken>
                <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:Nonce>***</wsse:Nonce>
                <wsu:Created xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">2018-05-10T17:03:34Z</wsu:Created>
            </wsse:UsernameToken>
        </wsse:Security>
        <oAuth xmlns="http://exacttarget.com">
            <oAuthToken>***</oAuthToken>
        </oAuth>
    </SOAP-ENV:Header>
    <SOAP-ENV:Body>
        <ns1:UpdateRequest>
            <ns1:Options/>
            <ns1:Objects xsi:type="ns1:Subscriber">
                <ns1:EmailAddress>foo@example.com</ns1:EmailAddress>
                <ns1:Status>Active</ns1:Status>
            </ns1:Objects>
        </ns1:UpdateRequest>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
1

I got this working by writing my SOAP request by hand in SoapUI and working backwards from there.

Despite a Patch being correct, the PHP Fuel SDK will only do a Patch+Upsert for a Subscriber if you use put().

The working code:

$obj = new ET_Subscriber();
$obj->authStub = $etClient;
$obj->props = ['Status' => 'Active', 'SubscriberKey' => '000076Etc22Fake'];
$result = $obj->put();

And the SOAP structure that's needed:

<?xml version="1.0" encoding="UTF-8"?>
<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>
        <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" SOAP-ENV:mustUnderstand="1">
            <wsse:UsernameToken>
                <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:Nonce>***</wsse:Nonce>
                <wsu:Created xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">2018-05-11T09:20:46Z</wsu:Created>
            </wsse:UsernameToken>
        </wsse:Security>
        <oAuth xmlns="http://exacttarget.com">
            <oAuthToken>***</oAuthToken>
        </oAuth>
    </SOAP-ENV:Header>

    <SOAP-ENV:Body>
        <ns1:UpdateRequest>
            <ns1:Options>
                <ns1:SaveOptions>
                    <ns1:SaveOption>
                        <ns1:PropertyName>*</ns1:PropertyName>
                        <ns1:SaveAction>UpdateAdd</ns1:SaveAction>
                    </ns1:SaveOption>
                </ns1:SaveOptions>
            </ns1:Options>
            <ns1:Objects xsi:type="ns1:Subscriber">
                <ns1:SubscriberKey>000076Etc22Fake</ns1:SubscriberKey>
                <ns1:Status>Active</ns1:Status>
            </ns1:Objects>
        </ns1:UpdateRequest>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

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.