I want to retrieve all contacts from a specific data extension via REST API but I don't find any documentation to do that.
Is there any way of retrieving all records from a data extension via REST API for Marketing Cloud?
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It only takes a minute to sign up.Sign up to join this community
There is an undocumented endpoint for getting records from a Data Extension using REST, with a filter defined by request parameters to the endpoint:
GET /data/v1/customobjectdata/key/YOURDEEXTERNALKEY/rowset?$filter=emailAddressfirstname.lastname@example.org' HTTP/1.1 Host: YOURTENANT.rest.marketingcloudapis.com Authorization: Bearer YOURAUTHTOKEN Content-Type: application/json User-Agent: PostmanRuntime/7.17.1 Accept: */* Cache-Control: no-cache Host: YOURTENANT.rest.marketingcloudapis.com Accept-Encoding: gzip, deflate Connection: keep-alive cache-control: no-cache
This is provided with NO GUARANTEES, and can be taken down or altered by Salesforce without any notice. I will not recommend using undocumented features in production context.
As to your question:
I want to retrieve all contacts from a specific data extension
This is doomed to fail, as you potentially don't have any control of the number of records in a given data extension. Remember that your API request might time-out, or return such a huge amount of data, that generating a response will not be feasible. I will advise against a solution which relies on pulling ALL records from a data extension. You would be better off (while building a more robust solution) using Data Extension Extract in Automation Studio.