1

I am trying to retrieve subscribers with information mentioned here:

https://developer.salesforce.com/docs/atlas.en-us.noversion.mc-apis.meta/mc-apis/retrieve_a_subscriber_via_the_web_service_api.htm

Tried to use the same soap envelope in SOAPUI and my request looks like below:

<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Header>
<fueloauth>TOKEN</fueloauth>
</Header>
      <Body>
      <RetrieveRequestMsg xmlns="http://exacttarget.com/wsdl/partnerAPI">
         <RetrieveRequest>
            <ObjectType>Subscriber</ObjectType>
            <Properties>CreatedDate</Properties>
            <Properties>Client.ID</Properties>
            <Properties>EmailAddress</Properties>
            <Properties>SubscriberKey</Properties>
            <Properties>Status</Properties>
            <Properties>UnsubscribedDate</Properties>
            <Properties>EmailTypePreference</Properties>
            <Filter xsi:type="SimpleFilterPart">
               <Property>CreatedDate</Property>
               <SimpleOperator>greaterThan</SimpleOperator>
               <DateValue>2012-01-04T10:19:00</DateValue>
            </Filter>
         </RetrieveRequest>
      </RetrieveRequestMsg>
   </Body>
</Envelope>

and request is sent to https://DOMAIN.soap.marketingcloudapis.com/ETFramework.wsdl

I am getting 200 ok as response but the response body is weird very long message and i didnt find any information about subscribers in this response message.

I also tried then to create subscriber using the request from here (https://developer.salesforce.com/docs/atlas.en-us.noversion.mc-apis.meta/mc-apis/creating_a_subscriber.htm) and noticed that response status code is 200 ok but the message looks same as what I got earlier for retrieve subscribers. Message is too long to copy paste here ..

  • I am not getting any error it says 200 ok but the response is some 30000 lines xml which doesnot have information I am looking for – sf_user Apr 23 at 9:28
  • 1
    iam using your code for its working – pkharries Apr 23 at 9:31
  • 1
    i got the subscriber information – pkharries Apr 23 at 9:31
  • 1
    use the mc username and password instead of token then try ? – pkharries Apr 23 at 9:33
  • 1
    Let us continue this discussion in chat. – pkharries Apr 23 at 9:34
4

Your question notes that you're sending requests to https://DOMAIN.soap.marketingcloudapis.com/ETFramework.wsdl (this will only give you descriptions of the service).

The SOAP service endpoint to retrieve the data you want should actually be https://DOMAIN.soap.marketingcloudapis.com/Service.asmx.

  • Thanks Mark.. that I believe is the first one... but now it says "login failed" when i am able to generate token using clientid and password and using the same token in fueloauth – sf_user Apr 23 at 10:09
  • 1
    @sf_user Ensure the token you're using hasn't expired (have you tried generating a new one?) and that the subdomains between the two endpoints (subdomains.auth.marketingcloudapis & subdomains.soap.marketingcloudapis) match. – Mark G Apr 23 at 10:29
  • I tried generating new token and used and same issue.. login failed.. but how to check subdomains match between 2 endpoints ? – sf_user Apr 23 at 10:32
  • when i am using fueloauth and use a token i am getting <faultstring>Login Failed</faultstring> and when i use usernametoken I am getting ` <faultstring>An invalid security token was provided</faultstring>` – sf_user Apr 23 at 10:35
  • @sf_user Compare the request URLs you're using to generate your token and retrieve the subscribers—do the unique strings after the https:// but before the marketingcloudapis domain match? As for your invalid security token, see salesforce.stackexchange.com/q/122776/55245 – Mark G Apr 23 at 10:44
1

this code for create subscriber in list

<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <Header>
 <Security xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity- 
secext-1.0.xsd">
   <UsernameToken>
   <Username>****</Username>
   <Password>xxxxx</Password>
   </UsernameToken>
  </Security>
 </Header>
<Body>
  <CreateRequest xmlns="http://exacttarget.com/wsdl/partnerAPI">
  <Options>
</Options>
<Objects xsi:type="Subscriber">
 <PartnerKey xsi:nil="true">
 </PartnerKey>
<ObjectID xsi:nil="true">
</ObjectID>

<EmailAddress>saomr@gmail.com</EmailAddress>
<SubscriberKey>saomr@gmail.com</SubscriberKey>
 <Attributes>
<Name>FirstName</Name>
<Value>Bob</Value>
</Attributes>
<Attributes>
<Name>LastName</Name>
<Value>Somelastname</Value>
</Attributes>
<Lists>
  <PartnerKey xsi:nil="true">
 </PartnerKey>
 <ID>**LISt ID here**</ID>
<ObjectID xsi:nil="true">
</ObjectID>
 </Lists>
 </Objects>
 </CreateRequest>
 </Body>
 </Envelope>

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.