0

I tried using this SOAP referral code but no luck, can someone help me on this.

     <s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
       <s:Header>
         <a:Action s:mustUnderstand="1">Retrieve</a:Action>
         <a:MessageID>urn:uuid:5dfca442-f1a0-4f7c-9419-8ace5658d2a3</a:MessageID>
         <a:ReplyTo>  <a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address>
         </a:ReplyTo>
         <a:To s:mustUnderstand="1">https://webservice.s6.exacttarget.com/Service.asmx</a:To>
         <o:Security s:mustUnderstand="1" xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
            <o:UsernameToken u:Id="uuid-88b91f91-bac2-489b-90fb-37e7b256e20c-1">
               <o:Username>ABCD</o:Username>
               <o:Password>ABCD</o:Password>
            </o:UsernameToken>
         </o:Security>
       </s:Header>
       <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
         <RetrieveRequestMsg xmlns="http://exacttarget.com/wsdl/partnerAPI">
         <RetrieveRequest>
            <ObjectType>AccountUser</ObjectType>
            <QueryAllAccounts>true</QueryAllAccounts>
            <Properties>email</Properties>
            <Properties>ActiveFlag</Properties>
            <Properties>CreatedDate</Properties>
            <Properties>isAPIUser</Properties>
            <Properties>UserID</Properties>
            <Properties>LastSuccessfulLogin</Properties>
         </RetrieveRequest>
         </RetrieveRequestMsg>
       </s:Body>
        </s:Envelope> 
1
  • Please share the response you are seeing when making that request. – Mac Feb 19 '20 at 13:36
2

You can do this via SOAP, WSProxy and an undocumented REST endpoint. Both SOAP and WSproxy will return some Role and Permission, where the REST API call will only return: id, memberId, userName, name, email, canImpersonate.

Below is the SOAP Envelope I use (Body only) when retrieveing this info:

      <RetrieveRequestMsg xmlns="http://exacttarget.com/wsdl/partnerAPI">
      <RetrieveRequest>
        <ObjectType>AccountUser</ObjectType>
        <Properties>AccountUserID</Properties>
        <Properties>ActiveFlag</Properties>
        <Properties>CustomerKey</Properties>
        <Properties>Email</Properties>
        <Properties>ID</Properties>
        <Properties>LastSuccessfulLogin</Properties>
        <Properties>ModifiedDate</Properties>
        <Properties>Name</Properties>
        <Properties>Roles</Properties>
        <Properties>UserID</Properties>
        <Properties>UserPermissions</Properties>
      </RetrieveRequest>
    </RetrieveRequestMsg>

Below is a WSProxy call I use:

 var prox = new Script.Util.WSProxy();
  if(mid) {
    // Set ClientID 
    prox.setClientId({ "ID": mid });
  }

  var cols = ["AccountUserID","ActiveFlag","CustomerKey","Email","ID","LastSuccessfulLogin","ModifiedDate","Name","Roles","UserID","UserPermissions"];

  var res = prox.retrieve("AccountUser", cols);

and finally below is the REST endpoint:

GET /platform/v1/accounts/{{MID}}/users
Host: https://{{subdomain}}.rest.marketingcloudapis.com/
Authorization: Bearer {{authToken}}
Content-Type: application/json
2
  • The soap request only returns the top level business unit results for me. Is there a way (with the soap call) to get the results for all business units (or for a business unit not the top level)? – Gail Parsloe Apr 9 at 14:25
  • Hi Gail, You can add a parameter for querying all accounts with: var QueryAllAccounts = true; Then edit the request to: var res = prox.retrieve("AccountUser", cols, null, QueryAllAccounts ); – Matt Goldstein Apr 26 at 17:55

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.