Skip to main content

Hi all!

 

Anyone with experience using the Data Extension Data API to retrieve data from Marketing Cloud? We're having some issues with this and would love some input! 😀

 

Short story: In Salesforce core we want to display emails sent from Marketing Cloud on a record. We want to retrieve these emails dynamically when viewing the record. We've attempted to retrieve this using the Data Extension Data API, but we're receiving error messages that we're not sure how to handle.

 

We've established connection to the Marketing Cloud REST API as described in the top comment here, using Named Credentials. We've successfully done callouts to /address/v1/validateEmail and /messaging/v1/domainverification, so the connection seems to be working.

 

However, when attempting any of the callouts on data extensions we are getting error messages:

 These return the following error message:

{"message":"There was no Custom Object found","errorcode":30003,"documentation":""}

 

 These return the following error message:

{"message":"custom object data cannot be retrieved for id: 1234567-1ABC-1234-A6C6-1234BC531A1A","errorcode":30003,"documentation":""}

 

This is a bit of a surprise, since we have managed to perform successful callouts to these methods from a local Python environment, but for some reason it's not returning any data when called from our Salesforce sandbox.

 

There's unfortunately very limited documentation on this, which is why I'm reaching out. Worst case we'll attempt to use the SOAP API instead, which seems slightly more complete/robust.😌

 

See extract from the Apex callout we use below:

Stringkey='1234567-1ABC-1234-A6C6-1234BC531A1A';

HttpRequestreq=newHttpRequest();

req.setEndpoint('callout:MarketingCloudREST/data/v1/customobjectdata/'+key+'/rowset');

req.setMethod('GET');

System.debug(req);

Httphttp=newHttp();

HttpResponseres=http.send(req);

System.debug(res.getBody());

@* Marketing Cloud Engagement * @* Salesforce Developers * @Marketer Group (MC), Oslo, NO @Developer Group, Oslo, NO

8 个回答
  1. 2024年6月25日 22:54

    Yes, used it and love that we finally got rest endpoints for this 🙌🚀

    Looking at the first and second error my guess is that you use the "Data Extension Key" and not the UI hidden Data Extension Id.

     

    You can find this quickly by using the network log in chrome when you access the folder of where your DE is stored. See screenshot.Yes, used it and love that we finally got rest endpoints for this 🙌🚀Looking at the first and second error my guess is that you use the

    Though not required to use the DE id. I have attached a video demo thrown togheter to illustrate how one can use External Actions in flow + unofficial SF Datatable to retrieve and display values. Almost no code solution if you want a Flow Driven Architecture in your org.

     

    Demo Marketing Cloud DE 720p.gif

     

    Side notes: 

    - If multiple business units. Is the MC APP configured in the business unit where you have the DE?

    - Was the permissions granted in the MC APP after the External + Named Credential setup?

    You may then need to refresh the auth token to get the new permissions quickly.

    - For my own curiosity; why are your creating a custom way of retrieving the emails? (When one have Marketing Cloud Connect that can do this natively)

    - In what way and format are you storing the emails?

     (I have here assumed you'r using ampScript/SSJS content block in all emails that inserts the whole email into Data Extension where you want to retrieve emails from using API. Or a daily MC Automation with a SSJS activity that uses the email API to retrieve all emails for today.)

     

    Ping me here, or on Slack and we can do a quick walkthrough or through some ideas out if you want to 😉

0/9000