I'm using the RetrieveRequest object in a SOAP request to retrieve all records in a Data Extension. This works well. Here's my 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">
        <wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
            <wsse:UsernameToken wsu:Id="UsernameToken-24440876" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
                <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">password</wsse:Password>
        <RetrieveRequestMsg xmlns="http://exacttarget.com/wsdl/partnerAPI">

The question is, can I include a filter in my request to limit the number of records returned, for example, rows 1-50? If so, what would that filter look like?

1 Answer 1


According to the RetrieveOptions Object you're able to limit the size of the request using BatchSize. I'm not 100% sure if it'll work as its description states

Number of records to return in each batch as part of a Retrieve call. Reserved for future use.

This looks to be the only property that can limit the request.

Working SOAP Body:

<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">
  • You could test this with SOAP UI and determine if it works. I'm not sure it does either, but it would be nice. Jan 26, 2014 at 12:09
  • Nice, I'm assuming I should be nesting RetreiveOptions inside the RetrieveRequest element like this snippet. I've tried a few different scenarios and they return all rows :-( <RetrieveRequestMsg xmlns="http://exacttarget.com/wsdl/partnerAPI"> <RetrieveRequest> <ObjectType>DataExtensionObject[DataExtensionKey]</ObjectType> <Properties>CustomerNo</Properties> <RetrieveOptions> <BatchSize>3</BatchSize> </RetrieveOptions> </RetrieveRequest> </RetrieveRequestMsg> Jan 26, 2014 at 18:25
  • @EliotHarper I've included a tested and working body for you to use in your API Call.
    – Amtera
    Jan 27, 2014 at 9:51
  • 2
    This is fantastic, thank you so much for adding this support! I just added <Options> <BatchSize>3</BatchSize> </Options> inside my RetrieveRequest and it works! Jan 27, 2014 at 19:48
  • 1
    This does not appear to work using the SSJS API functions. Jul 11, 2016 at 16:24

You must log in to answer this question.

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