0

I am trying to apply filer condition on the SentEvent Object.Initially I was getting error related to Bad request. But now the API call is not failing but then I am not getting the filtered data here. Please let me know where its going wrong. I am using oauth2 with this soap call.Below is my soap call request.

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:par="http://exacttarget.com/wsdl/partnerAPI" xmlns:xsi="xsi">
   <soapenv:Header>
      <fueloauth><oauth2-key></fueloauth>
   </soapenv:Header>
   <soapenv:Body>
      <par:RetrieveRequestMsg>
         <par:RetrieveRequest>
            <par:ObjectType>SentEvent</par:ObjectType>
            <par:Properties>Client.ID</par:Properties>
            <par:Properties>TriggeredSendDefinitionObjectID</par:Properties>
            <par:Properties>SendID</par:Properties>
            <par:Properties>SubscriberKey</par:Properties>
            <par:Properties>EventDate</par:Properties>
            <par:Properties>EventType</par:Properties>
            <par:Properties>BatchID</par:Properties>
            <par:Properties>ListID</par:Properties>
            <Filter xsi:type="ns1:SimpleFilterPart" xmlns:ns1="http://exacttarget.com/wsdl/partnerAPI">
                   <Property>EventDate</Property>
                   <SimpleOperator>greaterThan</SimpleOperator>
                   <DateValue>2020-02-23T00:00:00-06:00</DateValue>
        </Filter>
         </par:RetrieveRequest>
      </par:RetrieveRequestMsg>
   </soapenv:Body>
</soapenv:Envelope>
3
  • This works as expected for me. Can you clarify what is meant by 'I am not getting the filtered data here' - it does not appear to be an issue with your envelope. Commented Mar 2, 2020 at 20:14
  • My filter condition says that I want data where EventDate is greater than 2020-02-23 but it was not applying the filter condition and i was getting all the records which were entered prior to the date mentioned in the filter criteria. Commented Mar 2, 2020 at 20:27
  • 1
    @Gortonington Just figured out that it was issue with the namespace. <par:Filter xsi:type="ns1:SimpleFilterPart" > <par:Property>EventDate</par:Property> <par:SimpleOperator>greaterThan</par:SimpleOperator> <par:DateValue>2020-02-25T10:30:43.173</par:DateValue> </par:Filter> Commented Mar 2, 2020 at 20:29

1 Answer 1

1

The issue is resolved. Posting the correct payload to be used for performing Soap call. There are 2 formats in which payload can be published.

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Header>
      <fueloauth><oauth2-token></fueloauth>
   </soapenv:Header>
   <soapenv:Body>
      <RetrieveRequestMsg xmlns="http://exacttarget.com/wsdl/partnerAPI">
         <RetrieveRequest>
            <ObjectType>SentEvent</ObjectType>
            <Properties>Client.ID</Properties>
            <Properties>TriggeredSendDefinitionObjectID</Properties>
            <Properties>SendID</Properties>
            <Properties>SubscriberKey</Properties>
            <Properties>EventDate</Properties>
            <Properties>EventType</Properties>
            <Properties>BatchID</Properties>
            <Properties>ListID</Properties>
            <Filter xsi:type="ns1:SimpleFilterPart" xmlns:ns1="http://exacttarget.com/wsdl/partnerAPI" >
                   <Property>EventDate</Property>
                   <SimpleOperator>greaterThan</SimpleOperator>
                   <DateValue>2020-02-25T10:30:43.173</DateValue>
            </Filter>
         </RetrieveRequest>
      </RetrieveRequestMsg>
   </soapenv:Body>
</soapenv:Envelope>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:par="http://exacttarget.com/wsdl/partnerAPI"  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns1="http://exacttarget.com/wsdl/partnerAPI">
   <soapenv:Header>
      <fueloauth><oauth-token></fueloauth>
   </soapenv:Header>
   <soapenv:Body>
      <par:RetrieveRequestMsg>
         <par:RetrieveRequest>
            <par:ObjectType>SentEvent</par:ObjectType>
            <par:Properties>Client.ID</par:Properties>
            <par:Properties>TriggeredSendDefinitionObjectID</par:Properties>
            <par:Properties>SendID</par:Properties>
            <par:Properties>SubscriberKey</par:Properties>
            <par:Properties>EventDate</par:Properties>
            <par:Properties>EventType</par:Properties>
            <par:Properties>BatchID</par:Properties>
            <par:Properties>ListID</par:Properties>
            <par:Filter xsi:type="ns1:SimpleFilterPart" >
                   <par:Property>EventDate</par:Property>
                   <par:SimpleOperator>greaterThan</par:SimpleOperator>
                   <par:DateValue>2020-02-25T10:30:43.173</par:DateValue>
            </par:Filter>
         </par:RetrieveRequest>
      </par:RetrieveRequestMsg>
   </soapenv:Body>
</soapenv:Envelope>

You must log in to answer this question.

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