I have a job to get subscriber attributes by email address through the Fuel API. I would like to batch these requests to get a list of subscribers corresponding to a list of email addresses rather than making a separate request for each email address; what's the best way to do this?
1 Answer
This can be achieved using the REST API Contacts Search method.
Here's a sample request:
POST https://www.exacttargetapis.com/contacts/v1/attributes/search?$page=1&$pageSize=100
Authorization: Bearer {{accessToken}}
Content-Type: application/json
{
"request":{
"attributes":[
{
"key":"Email Demographics.firstname"
},
{
"key":"Email Demographics.lastname"
},
{
"key":"Email Demographics.company"
}
]
},
"conditionSet":{
"operator":"Or",
"conditionSets":[
],
"conditions":[
{
"attribute":{
"key":"Email Addresses.Email Address"
},
"operator":"Equals",
"value":{
"items":[
"[email protected]"
]
}
},
{
"attribute":{
"key":"Email Addresses.Email Address"
},
"operator":"Equals",
"value":{
"items":[
"[email protected]"
]
}
}
]
}
}
Notes:
- You can use this method to search Attributes in any Attribute Set in your Contact model (email subscribers are included by default in the 'Email Demographics' Attribute Set which you will find in the Email Data Attribute Group).
firstname
,lastname
andcompany
are Subscriber Profile Attributes; update these to match your subscriber attributes that you want to return.- the
page
andpageSize
URL parameters limit the amount of records returned to reduce the response payload. AdjustpageSize
as required. The response payload includes acount
of records returned, so you can work out how many requests you need to make to retrieve subsequent pages.
-
Andrew, please confirm if my solution answered your question. Commented Apr 28, 2017 at 1:39