I want to get SubscriberStatusEvent using:
https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/retrieving_the_subscriberstatusevent.html
the following code returns OK but there is no data. What might be the problem?
<?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:To s:mustUnderstand="1">https://{{et_subdomain}}.soap.marketingcloudapis.com/Service.asmx</a:To>
<fueloauth xmlns="http://exacttarget.com">{{dne_etAccessToken}}</fueloauth>
</s:Header>
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<RetrieveRequestMsg xmlns="http://exacttarget.com/wsdl/partnerAPI">
<RetrieveRequest>
<ObjectType>SubscriberStatusEvent</ObjectType>
<QueryAllAccounts>true</QueryAllAccounts>
<Properties>Client.ID</Properties>
<Properties>CreatedDate</Properties>
<Properties>CurrentStatus</Properties>
<Properties>ObjectID</Properties>
<Properties>PreviousStatus</Properties>
<Properties>ReasonUnsub</Properties>
<Properties>SubscriberID</Properties>
<Properties>SubscriberKey</Properties>
<Filter xsi:type="SimpleFilterPart" xmlns:par="http://exacttarget.com/wsdl/partnerAPI">
<Property>SubscriberKey</Property>
<SimpleOperator>equals</SimpleOperator>
<Value>[email protected]</Value>
</Filter>
</RetrieveRequest>
</RetrieveRequestMsg>
</s:Body>
</s:Envelope>
POSTMAN Python code:
import http.client
conn = http.client.HTTPSConnection("DOMAIN.soap.marketingcloudapis.com")
payload = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<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\\\">\n <s:Header>\n <a:Action s:mustUnderstand=\"1\">Retrieve</a:Action> \n <a:To s:mustUnderstand=\"1\">https://DOMAIN.soap.marketingcloudapis.com/Service.asmx</a:To> \n <fueloauth xmlns=\"http://exacttarget.com\">OAUTHTOKEN</fueloauth> \n </s:Header> \n <s:Body xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">\n <RetrieveRequestMsg xmlns=\"http://exacttarget.com/wsdl/partnerAPI\">\n <RetrieveRequest>\n <ObjectType>SubscriberStatusEvent</ObjectType>\n <QueryAllAccounts>true</QueryAllAccounts>\n <Properties>Client.ID</Properties>\n <Properties>CreatedDate</Properties>\n <Properties>CurrentStatus</Properties>\n <Properties>ObjectID</Properties>\n <Properties>PreviousStatus</Properties>\n <Properties>ReasonUnsub</Properties>\n <Properties>SubscriberID</Properties>\n <Properties>SubscriberKey</Properties>\n <Filter xsi:type=\"SimpleFilterPart\" xmlns:par=\"http://exacttarget.com/wsdl/partnerAPI\">\n <Property>SubscriberKey</Property>\n <SimpleOperator>equals</SimpleOperator>\n <Value>[email protected]</Value>\n </Filter>\n </RetrieveRequest> \n </RetrieveRequestMsg>\n </s:Body>\n </s:Envelope>"
headers = {
'Content-Type': 'application/xml'
}
conn.request("POST", "/Service.asmx", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))