0

I'm trying to figure out how to use the SOAP API to check if a Subscriber has unsubscribed from any List that they appear on.

I'm using the example SOAP envelope provided for Retrieving All Lists a Subscriber is On but I don't get the subscription status in the response. Any ideas?

Request

<?xml version="1.0" encoding="utf-8"?>
<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>
      <fueloauth xmlns="http://exacttarget.com">accessTokenHere</fueloauth>
   </soapenv:Header>
   <soapenv:Body>
      <RetrieveRequestMsg xmlns="http://exacttarget.com/wsdl/partnerAPI">
         <RetrieveRequest>
            <ObjectType>ListSubscriber</ObjectType>
            <Properties>ListID</Properties>
            <Properties>Status</Properties>
            <Filter xsi:type="ns1:SimpleFilterPart" xmlns:ns1="http://exacttarget.com/wsdl/partnerAPI">
               <Property>SubscriberKey</Property>
               <SimpleOperator>equals</SimpleOperator>
               <Value>999999</Value>
            </Filter>
         </RetrieveRequest>
      </RetrieveRequestMsg>
   </soapenv:Body>
</soapenv:Envelope>

Response

<?xml version="1.0" encoding="utf-8"?>
<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>RetrieveResponse</wsa:Action>
        <wsa:MessageID>urn:uuid:a70527a2-79b8-4ed2-b3ec-5adb828620c1</wsa:MessageID>
        <wsa:RelatesTo>urn:uuid:8686747c-f7cc-459b-8256-2603eb13e3a2</wsa:RelatesTo>
        <wsa:To>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:To>
        <wsse:Security>
            <wsu:Timestamp wsu:Id="Timestamp-56623383-47ec-4cf0-b6e4-67cc30e1427e">
                <wsu:Created>2015-01-29T03:45:13Z</wsu:Created>
                <wsu:Expires>2015-01-29T03:50:13Z</wsu:Expires>
            </wsu:Timestamp>
        </wsse:Security>
    </soap:Header>
    <soap:Body>
        <RetrieveResponseMsg
            xmlns="http://exacttarget.com/wsdl/partnerAPI">
            <OverallStatus>OK</OverallStatus>
            <RequestID>2035f0c1-1ec7-41e2-a1db-b40c3a5ac399</RequestID>
            <Results xsi:type="ListSubscriber">
                <PartnerKey xsi:nil="true" />
                <ObjectID xsi:nil="true" />
                <ListID>372</ListID>
            </Results>
            <Results xsi:type="ListSubscriber">
                <PartnerKey xsi:nil="true" />
                <ObjectID xsi:nil="true" />
                <ListID>13638</ListID>
            </Results>
        </RetrieveResponseMsg>
    </soap:Body>
</soap:Envelope>
2

You are missing this property in your SOAP envelope

<Properties>SubscriberKey</Properties>

You have just added it as a filter without first setting it as a property. That should fix it.

  • Hello Gaurav, that does not work. I deliberately did not include that property in my request as I don't need the SubscriberKey (it's in my filter, so I know what the SubscriberKey is). However if I do include it, I get exactly the same response as above. The Subscriber Status is not returned in the response. – Eliot Harper Jan 29 '15 at 15:29
  • I've always found it useful to return Subscriber key ad it helps track the results and match subscribers, I agree that API returns unexpected results sometimes and would strongly recommend raising a support case. – Gaurav Kheterpal Jan 30 '15 at 5:25
0

I'd try specifying all of the retrievable properties for the ListSubscriber object.

  • Client.ID
  • Client.PartnerClientKey
  • CreatedDate
  • ID
  • ListID
  • ModifiedDate
  • ObjectID
  • Status
  • List item
  • SubscriberKey

I was able to retrieve the status by list with the properties above.

Request

<?xml version="1.0" encoding="UTF-8"?>
<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">Retrieve</a:Action>
      <a:MessageID>urn:uuid:6e8a12c5-dd24-456b-80d0-582d5506b867</a:MessageID>
      <a:ReplyTo>
         <a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address>
      </a:ReplyTo>
      <a:To s:mustUnderstand="1">https://webservice.exacttarget.com/Service.asmx</a:To>
      <o:Security xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" s:mustUnderstand="1">
         <u:Timestamp u:Id="_0">
            <u:Created>2015-01-29T17:47:15.716Z</u:Created>
            <u:Expires>2015-01-29T17:52:15.716Z</u:Expires>
         </u:Timestamp>
         <o:UsernameToken u:Id="uuid-1c0f4e43-a32f-4f4d-8fcf-1cd220265fde-3">
            <o:Username>XXXXXXXX</o:Username>
            <o:Password>XXXXXXXX</o:Password>
         </o:UsernameToken>
      </o:Security>
   </s:Header>
   <s:Body xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <RetrieveRequestMsg xmlns="http://exacttarget.com/wsdl/partnerAPI">
         <RetrieveRequest>
            <ObjectType>ListSubscriber</ObjectType>
            <Properties>Client.ID</Properties>
            <Properties>Client.PartnerClientKey</Properties>
            <Properties>CreatedDate</Properties>
            <Properties>ID</Properties>
            <Properties>ListID</Properties>
            <Properties>ModifiedDate</Properties>
            <Properties>ObjectID</Properties>
            <Properties>Status</Properties>
            <Properties>SubscriberKey</Properties>
            <Filter xsi:type="SimpleFilterPart">
               <Property>SubscriberKey</Property>
               <SimpleOperator>equals</SimpleOperator>
               <Value>aspriggs@degdigital.com</Value>
            </Filter>
            <Retrieves />
         </RetrieveRequest>
      </RetrieveRequestMsg>
   </s:Body>
</s:Envelope>

Response

<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" 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" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <env:Header xmlns:env="http://www.w3.org/2003/05/soap-envelope">
      <wsa:Action>RetrieveResponse</wsa:Action>
      <wsa:MessageID>urn:uuid:d83482e1-d2f5-47f1-8766-27adfafb91b6</wsa:MessageID>
      <wsa:RelatesTo>urn:uuid:6e8a12c5-dd24-456b-80d0-582d5506b867</wsa:RelatesTo>
      <wsa:To>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:To>
      <wsse:Security>
         <wsu:Timestamp wsu:Id="Timestamp-8e428455-3df4-4c0f-8328-e444b9c65fa5">
            <wsu:Created>2015-01-29T17:47:17Z</wsu:Created>
            <wsu:Expires>2015-01-29T17:52:17Z</wsu:Expires>
         </wsu:Timestamp>
      </wsse:Security>
   </env:Header>
   <soap:Body>
      <RetrieveResponseMsg xmlns="http://exacttarget.com/wsdl/partnerAPI">
         <OverallStatus>OK</OverallStatus>
         <RequestID>ae5f743f-b353-464a-ab94-25ce0663aab3</RequestID>
         <Results xsi:type="ListSubscriber">
            <Client>
               <ID>XXXXXXXX</ID>
            </Client>
            <PartnerKey xsi:nil="true" />
            <CreatedDate>2014-05-13T09:19:00</CreatedDate>
            <ModifiedDate>2014-10-29T11:25:00</ModifiedDate>
            <ID>1117829630</ID>
            <ObjectID>6473212352</ObjectID>
            <Status>Unsubscribed</Status>
            <ListID>XXXXXXXX</ListID>
            <SubscriberKey>aspriggs@degdigital.com</SubscriberKey>
         </Results>
         <Results xsi:type="ListSubscriber">
            <Client>
               <ID>XXXXXXXX</ID>
            </Client>
            <PartnerKey xsi:nil="true" />
            <CreatedDate>2014-03-17T21:32:00</CreatedDate>
            <ModifiedDate>2014-10-29T11:25:00</ModifiedDate>
            <ID>1117829630</ID>
            <ObjectID>6258135573</ObjectID>
            <Status>Active</Status>
            <ListID>XXXXXXXX</ListID>
            <SubscriberKey>aspriggs@degdigital.com</SubscriberKey>
         </Results>
      </RetrieveResponseMsg>
   </soap:Body>
</soap:Envelope>

If that doesn't work, I'd take a look at the API user you're using and make sure it has access to the business unit.

  • Thanks Adam, that didn't work either (I get the same response). I'll try with another users' credentials and see if that helps. If not, it must be a config issue and I'll raise a ticket on 3Sixty. I'll keep this question open for now and once I've identified the problem I'll let you know. – Eliot Harper Jan 29 '15 at 18:32
0

I tried using another users' credentials to make the same request (in my original question) and I received a response with the subscriber status, so it must be a user-based permission issue. Thanks Adam and Gaurav for your assistance.

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.