is there any REST API request to get a list of all Data Extensions in my Business Unit?
[SalesForce] Marketing Cloud REST API – Show List of Data Extension
Related Solutions
According to this discussion with some SFMC folks, all you need to do is set the ClientID
to the parent MID to access the shared Data Extensions.
My first thought was to use the ent.
prefix, but that's only for DE Names, not external keys.
We managed to retrieve the fields of a given DE using SOAP Api, you also can place it in a REST call. You can use a token or a User/pwd to authenticate.
Example of rest call using POSTMAN:
POST /Service.asmx HTTP/1.1
Host: <Your host instance ie: webservice.s6.exacttarget.com>
Content-Type: text/xml
SOAPAction: "Retrieve"
Cache-Control: no-cache
Postman-Token: 588f0a33-ff05-de0f-b4f2-28ce7751c582
<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">
<!--<soapenv:Header>
<fueloauth xmlns="http://exacttarget.com"><YOUR TOKEN></fueloauth>
</soapenv:Header>-->
<soapenv:Header>
<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>
<wsse:Username><YOUR USERNAME></wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText"><YOUR PWD></wsse:Password>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>
<soapenv:Body>
<RetrieveRequestMsg xmlns="http://exacttarget.com/wsdl/partnerAPI">
<RetrieveRequest>
<ObjectType>DataExtensionField</ObjectType>
<Properties>FieldType</Properties>
<Properties>Name</Properties>
<Properties>IsRequired</Properties>
<Properties>MaxLength</Properties>
<Properties>Ordinal</Properties>
<Properties>Scale</Properties>
<Filter xsi:type="SimpleFilterPart">
<Property>DataExtension.CustomerKey</Property>
<SimpleOperator>equals</SimpleOperator>
<Value><YOUR DE_CustomerKey></Value>
</Filter>
<QueryAllAccounts>false</QueryAllAccounts>
<Retrieves />
<Options>
<SaveOptions />
<IncludeObjects>true</IncludeObjects>
</Options>
</RetrieveRequest>
</RetrieveRequestMsg>
</soapenv:Body>
</soapenv:Envelope>
Best Answer
You'll have to use the SOAP API to retrieve DataExtension objects.
Here's a sample SOAP envelope that illustrates the structure of the call:
At this point in time, the SFMC SOAP API is significantly more complete/robust/whatever than the REST API. It's a good plan to follow the lead of the SFMC SDK, which utilizes both SOAP and REST.