I need subscriptionKey from salesforce marketing cloud based on other field(such as email, customerId). I want to create API in which I will pass value of those field and I would like to return SubscriptionKey. Is it possible? If so, how?

this way we can get other key based on subscriberkey but I want to do reverse form ID I want to retrieve subscription key

string requestID = null;
APIObject[] results = null;
SimpleFilterPart sfp = new SimpleFilterPart();
sfp.Property = "SubscriberKey";
sfp.SimpleOperator = SimpleOperators.IN;
sfp.Value = new String[] { "1", "2", "8" };
// Retrieve the ID, SubscriberKey and EmailAddress for the Subscribers
RetrieveRequest rr = new RetrieveRequest();
rr.ObjectType = "Subscriber";
rr.Properties = new string[] { "ID", "SubscriberKey", "EmailAddress" };
rr.Filter = sfp;
// You can retrieve subscribers from specific accounts
// rr.ClientIDs = ...
// Or, you can retrieve subscribers across the parent account and all sub accounts
// rr.QueryAllAccounts = true;
// rr.QueryAllAccountsSpecified = true;
string status = integrationFramework.Retrieve(rr, out requestID, out results);
  • You’re getting downvoted because you haven’t shown any attempts nor have formulated a specific question. Your question can be answered by checking the api documentation. The answer your seeking is much longer than the purpose of this forum – Tom Callahan Mar 19 '19 at 6:32

This is how I Solve this. Hope this help someone else

            soapClient.Endpoint.EndpointBehaviors.Add(new FuelOAuthHeaderBehavior("accessToken"));
            string requestId;
            APIObject[] results;
            SimpleFilterPart sfp = new SimpleFilterPart();
            sfp.Property = "User_ID";
            sfp.SimpleOperator = SimpleOperators.equals;
            sfp.Value = new string[] { "123456" };
            RetrieveRequest rr = new RetrieveRequest();
            rr.Filter = sfp;
            rr.Properties = new string[] { "Salesforce_Subscriber_Key" };
            rr.ObjectType = "DataExtensionObject[dataextentionobjectkey]";
            string status = soapClient.Retrieve(rr, out requestId, out results);
            if (status != null && status.ToLower().Equals("ok"))
                if (results != null)
                    DataExtensionObject obj = (DataExtensionObject)results[0];
                    string subscriberKey = obj.Properties[0].Value;
        catch (Exception ex)
            string error = ex.ToString();

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.