Retrieve Data from a Data Extension
Use the retrieve method to get data from a data extension. You can retrieve up to 2,500 records per request.
Keep these considerations in mind when you use SOAP API to retrieve data from data extensions.
If you issue one or fewer calls per hour, you can achieve better performance and efficiency by using a data extract activity to deliver the data to your Enhanced FTP location.
The data extension object doesn’t support LIKE operators in filters for the retrieve method.
When you retrieve a column that contains the Date data type, SOAP API returns a value that’s rounded to the nearest second, followed by AM or PM. This behavior occurs even when the source timestamp contains millisecond data. As a result, if you use a Date column as a primary key, it can prevent you from retrieving unique rows. For this reason, we recommend against using Date values as primary keys.
Sample SOAP Request
This sample SOAP envelope represents a request to retrieve several fields from a data extension based on the value of the MemberId column.
1 < s:Envelope xmlns:s = "http://www.w3.org/2003/05/soap-envelope"
2 xmlns:a = "http://schemas.xmlsoap.org/ws/2004/08/addressing"
3 xmlns:u = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" >
4 < s:Header >
5 < a:Action s:mustUnderstand = "1" > Retrieve </ a:Action >
6 < a:To s:mustUnderstand = "1" >
7 https://YOUR_SUBDOMAIN.soap.marketingcloudapis.com/Service.asmx </ a:To >
8 < fueloauth xmlns = "http://exacttarget.com" > YOUR_ACCESS_TOKEN </ fueloauth >
9 </ s:Header >
10 < s:Body xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"
11 xmlns:xsd = "http://www.w3.org/2001/XMLSchema" >
12 < RetrieveRequestMsg xmlns = "http://exacttarget.com/wsdl/partnerAPI" >
13 < RetrieveRequest >
14 < ObjectType > DataExtensionObject[MembershipRewardsProgramme] </ ObjectType >
15 < Properties > FirstName </ Properties >
16 < Properties > Surname </ Properties >
17 < Properties > Area </ Properties >
18 < Properties > RewardsPoints </ Properties >
19 < Filter xsi:type = "SimpleFilterPart" >
20 < Property > MemberId </ Property >
21 < SimpleOperator > equals </ SimpleOperator >
22 < Value > dc415965-f672-4381-993f-1ffd00a9dab6 </ Value >
23 </ Filter >
24 </ RetrieveRequest >
25 </ RetrieveRequestMsg >
26 </ s:Body >
27 </ s:Envelope >
Sample SOAP Response
If the information from the request is found in the data extension, the response contains that information.
1 < soap:Envelope xmlns:soap = "http://www.w3.org/2003/05/soap-envelope"
2 xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"
3 xmlns:xsd = "http://www.w3.org/2001/XMLSchema"
4 xmlns:wsa = "http://schemas.xmlsoap.org/ws/2004/08/addressing"
5 xmlns:wsse = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
6 xmlns:wsu = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" >
7 < env:Header xmlns:env = "http://www.w3.org/2003/05/soap-envelope" >
8 < wsa:Action > RetrieveResponse </ wsa:Action >
9 < wsa:MessageID > urn:uuid:a8496aed-18c2-4eaf-b10b-0784aa6f8fd4 </ wsa:MessageID >
10 < wsa:RelatesTo > urn:uuid:67ab5548-912e-4c51-9d53-d9f68d0370e6 </ wsa:RelatesTo >
11 < wsa:To > http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous
12 </ wsa:To >
13 < wsse:Security >
14 < wsu:Timestamp wsu:Id = "Timestamp-faa7151b-48c9-498d-b690-8035c5202d95" >
15 < wsu:Created > 2024-07-10T19:03:56Z </ wsu:Created >
16 < wsu:Expires > 2024-07-10T19:08:56Z </ wsu:Expires >
17 </ wsu:Timestamp >
18 </ wsse:Security >
19 </ env:Header >
20 < soap:Body >
21 < RetrieveResponseMsg xmlns = "http://exacttarget.com/wsdl/partnerAPI" >
22 < OverallStatus > OK </ OverallStatus >
23 < RequestID > 4f7cc213-3b96-4c5c-9684-f23f0d7c1fcd </ RequestID >
24 < Results xsi:type = "DataExtensionObject" >
25 < PartnerKey xsi:nil = "true" />
26 < ObjectID xsi:nil = "true" />
27 < Type > DataExtensionObject </ Type >
28 < Properties >
29 < Property >
30 < Name > FirstName </ Name >
31 < Value > Pooja </ Value >
32 </ Property >
33 < Property >
34 < Name > Surname </ Name >
35 < Value > Chatterjee </ Value >
36 </ Property >
37 < Property >
38 < Name > Area </ Name >
39 < Value > Hammersmith </ Value >
40 </ Property >
41 < Property >
42 < Name > RewardsPoints </ Name >
43 < Value > 201042 </ Value >
44 </ Property >
45 </ Properties >
46 </ Results >
47 </ RetrieveResponseMsg >
48 </ soap:Body >
49 </ soap:Envelope >