Is there any endpoint that I can use in Marketing Cloud REST API to retrieve contact key/subscriber key of a particular device ?
-
SubscriberKey/ ContactKey are set on the subscriber level not per device..i.e it doesnt matter which device they are using, they would have the same subscriberkey– 0xsegfaultCommented Nov 1, 2017 at 19:05
-
Do you mean searching for a contact API call? I'd use this developer.salesforce.com/docs/…– Brad Sapkota - altus.digitalCommented Nov 1, 2017 at 22:12
-
@Data_Kid : In salesforce Android SDK after initializing the SDK we get the particular device ID by invoking 'MarketingCloudSdk.getInstance().getRegistrationManager().getDeviceId();' And then we can set the subscriber ID by 'MarketingCloudSdk.getInstance().getRegistrationManager().edit().setContactKey("").commit();'. What i'm asking is is there any endpoint in Marketing Cloud REST API which gives the same functionality but the other way around.– Sajith KonaraCommented Nov 2, 2017 at 5:14
-
@BradSapkota, I checked that endpoint but what I my use case is to check whether the particular user has already opt-in for push and if he does I want to retrieve that particular contactkey to mobile end so that It won't impact the fact that in android SDK 5.2.0 it generates new device ID in each installation. (Because so far in our application (which uses a old SDK) we have set the contact key as the same as the device ID)– Sajith KonaraCommented Nov 2, 2017 at 5:20
Add a comment
|
1 Answer
You can search the contact by attributes. Here is an example using MobileConnect Demographics
Host: https://www.exacttargetapis.com
POST /contacts/v1/contacts/search
Content-Type: application/json
Authorization: Bearer YOUR_ACCESS_TOKEN
{
"request": {
"attributes": [{
"key": "MobileConnect Demographics.First Name"
},
{
"key": "MobileConnect Demographics.Last Name"
},
{
"key": "MobileConnect Demographics.Mobile Number"
}]
},
"conditionSet": {
"operator": "And",
"conditionSets": [],
"conditions": [{
"attribute": {
"key": "MobileConnect Demographics.Mobile Number"
},
"operator": "Equals",
"value": {
"items": ["6598061800"]
}
}]
}
}
Replace the MobileConnect Demographics.Mobile Number with MobilePush Demographics.Device ID