7

The REST API documentation doesn't have any method to read from a data extension while it has a couple of writing into it.

So is SOAP is the only API to read from a DE?

11

It's not documented save for a call to GET https://www.exacttargetapis.com/data/v1/rest, but GET https://www.exacttargetapis.com/data/v1/customobjectdata/key/[DE CustomerKey]/rowset/ will do exactly what you want, and it's not limited to data extensions linked to the contact model.

I've also found it will accept at least the same query string parameters as the ContentBuilder simple asset query plus $top. You can build more complex filters with AND, OR, and parentheses. Property IS [NOT] NULL works too.

  • I don't know how you found this but it is brilliant - thank you! – AnonWonderer Aug 15 '18 at 22:24
  • This is very nice solution. I just wanted to check if we can search by a particular value?Currently, this gives me all the records. In future, if records are more than 2,000 then I think it will be very time consuming. – user36778 Dec 7 '18 at 18:26
  • @user36778 The route understands the same query string parameters as the Content Builder simple asset query route, so you could, for example, filter the results with a query string like ...rowset/?$filter=FirstName%20eq%20Robert to get rows where FirstName is Robert. I've tested all but like, but that doesn't mean it's not implemented; it's finicky about which characters get url-encoded. – Clayton VonDras Dec 7 '18 at 23:15
  • 1
    There are loads of undocumented api routes you can find with a call to GET https://www.exacttargetapis.com/<module>/v1/rest. They're poorly (not) documented, and I wouldn't rely on them for mission critical stuff, but they've proven exceptionally useful in specific situations. For instance, I once had a broken ContactBuilder relationship that was causing the web interface to hang; I resolved it by modifying the contact model with an undocumented route. Obviously, it'll give you more power than SFMC intended, so be careful with how you use it. – Clayton VonDras Dec 7 '18 at 23:24
  • 1
    WORKED, thanks @ClaytonVonDras!!!: ?$filter=emailaddress%20eq%20"joe%40somewhere.com" – victorcorey May 3 at 18:32
0

Probably best bet is something like https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/fetchAttributes.htm which allows you to go through DEs with are in the contact model.

For example:

Host: https://www.exacttargetapis.com
POST /contacts/v1/attributes/search 
Content-Type: application/json
Authorization: Bearer YOUR_ACCESS_TOKEN

{
    "request": {
        "attributes": [{
                "key": "MobileConnect Demographics.First Name"
            },
            {
                "key": "MobileConnect Demographics.Last Name"
            },
            {
                "key": "Retail Orders.Order Number"
            },
            {
                "key": "Retail Orders.Order Total"
            }]

    },
    "conditionSet": {
        "operator": "And",
        "conditionSets": [],
        "conditions": [{
            "attribute": {
                "key": "Retail Orders.Order Total"
            },
            "operator": "GreaterThan",
            "value": {
                "items": ["1,000.00"]
            }
        }]
    }
}
  • Can you cite at least some of the relevant content here if the link answers the question? Links tend to break over time, so answers are much improved if they can stand on their own even were the links to go dead. – Adrian Larson Apr 24 '17 at 21:17
  • Good Point! Editing now :D – Doug May 20 '17 at 16:55
  • @Doug is key used in above example is external key for DE? The link developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/… seems to be not working. Thanks – Chandan Jul 15 at 2:55
  • Hi @Chandan, this is all based on Fully Qualified Name from Contact Builder. It doesnt required External Keys at all. – Doug Jul 15 at 14:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.