Skip to content
This repository has been archived by the owner on Jan 20, 2024. It is now read-only.

Trying to filter DataExtensions using a Client.ID but we get Filter Property 'Client.ID' is not a retrievable property #148

Open
pentium10 opened this issue Jul 18, 2019 · 10 comments
Labels

Comments

@pentium10
Copy link

We have this little piece of code

    $getDERows = new ET_DataExtension_Row();
    $getDERows->authStub = $this->soap_client;
    $getDERows->filter = array("Property" => "Client.ID", "SimpleOperator" => "equals", "Value" => $this->client_id);
    $getDERows->props = array('ELECTRONICTXT', 'IDENTIFIER', 'TITLE', 'DATE');
    $getDERows->Name = $customerKey;
    $getDERows->CustomerKey = $customerKey;
    $res = $getDERows->get();

As you see we have 3 variables:

  • name
  • customer key (these are the same - not sure if good)
  • client id (mid)

When I run this:

Message: Error: The Filter Property 'Client.ID' is not a retrievable property

and I frankly don't know how to filter based on the Client.ID the data extensions rows. If I remove the filter row, it returns a bunch of results which noone can tell us from which Client.ID came.

@pentium10 pentium10 added the bug label Jul 18, 2019
@pentium10
Copy link
Author

@garek007 do you know how can we push/filter DataExtensions based on Client.ID

@garek007
Copy link

Not sure if you're still having this issue, but ID needs to be an array. So it's not client.id, you'd set the client property to array like array("ID",820047); or something like that. I think I got it working. If you're still in need I can find the code.

@pentium10
Copy link
Author

yes please @garek007, we still didn't sort this piece out, and we have a very inefficient call, retrieving all then filtering with other vanilla code

@garek007
Copy link

garek007 commented Dec 30, 2022

Try it like this


        $get->props = array(
          "Name" => $deName, 
          "CustomerKey" => str_replace(" ", "_", $deName),
          "IsSendable" => true,
          "Client"=> array("ID" => 1234567),
          "SendableDataExtensionField" => array(
            "Name"=>"SubscriberKey",
            "Value"=> NULL
          ),
          "SendableSubscriberField"=>array(
            "Name" => "Subscriber Key",
            "Value" => NULL
          )
        );

This is for creating a data extension, so just pay attention to the part with the client id. You pass Client as a property, not in the filter, then the ID is an array.

Another way you should be able to do it is during authentication. Did you know that when you authenticate you can specify a specific business unit?


    $config = array(
      'appsignature' => 'none',
      'clientid' => $config["id"],
      'clientsecret' => $config["secret"],
      'baseAuthUrl' => $config["authURL"],
      'defaultwsdl' => 'https://webservice.exacttarget.com/etframework.wsdl',
      'xmlloc' => dirname(__DIR__,1).'/ExactTargetWSDL.xml',    
      'baseSoapUrl' => $config["soapURL"],
      'baseUrl' => $config["restURL"],    
      'useOAuth2Authentication' => true,
      'accountId' => 123456789
    );

@pentium10
Copy link
Author

pentium10 commented Dec 30, 2022

your example is for setting data

I want to FILTER on READ, I am not the one who created the Data Extension. I need to read it to see if it has something in it.

@pentium10
Copy link
Author

pentium10 commented Dec 30, 2022

actually, I think I figured it out by using retrieveRequest

$getDERows = new ET_DataExtension_Row();
$getDERows->authStub = $this->soap_client;
$getDERows->retrieveRequest['ClientIDs'] = array('ID' => $this->client_id);
$getDERows->props = array('ELECTRONIC_ADDRESS_TXT', 'UNIQUE_IDENTIFIER', 'TITLE_OF_CAMPAIGN', 'INSERT_DATE');
$getDERows->Name = $customerKey;
$getDERows->CustomerKey = $customerKey;

$res = $getDERows->get();

@garek007
Copy link

It should be the same though, pass an array. It should work with retrieve. I also have some code for simple and complex filters too, but I don't think they work for this.

@pentium10
Copy link
Author

however now I don't know the reason why sometimes there is a function

  • filter()
    and sometimes
  • retrieveRequest()

@garek007
Copy link

garek007 commented Dec 30, 2022

IDK, it's just the way the built the SDK I guess. The way I finally figured it out was by looking at the structure of some soap envelopes. They give you a hint at the code. I saw that ID was nested, and so I tried it with PHP. If you can download one of the free postman collections, it can help you solve some of these things. If it works in the SOAP envelope, it should be the same structure in the code. Also the docs should list the properties that are available as well as the items you can use for filtering.


<?xml version="1.0" encoding="UTF-8"?>
<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">Create</a:Action>
      <a:MessageID>urn:uuid:7e0cca04-57bd-4481-864c-6ea8039d2ea0</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">{{soapEndPoint}}</a:To>
      <o:Security xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" s:mustUnderstand="1">
         <o:UsernameToken>
            <o:Username>{{soapUsername}}</o:Username>
            <o:Password><![CDATA[{{soapPassword}}]]></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">
		<CreateRequest xmlns="http://exacttarget.com/wsdl/partnerAPI">
        <!--
            <Options>
             <SendResponseTo>
      		<ResponseType>email</ResponseType>
      		<ResponseAddress>[email protected]</ResponseAddress>
      		<RespondWhen>OnCallComplete</RespondWhen>
      		<IncludeResults>true</IncludeResults>
      		<IncludeObjects>true</IncludeObjects>
  		   </SendResponseTo>
             <RequestType>Asynchronous</RequestType>
      	    </Options>
      	-->
         <Objects xsi:type="DataExtension">
            <!--
            <Client>
                <ID>10798224</ID>
            </Client>
            -->
            <CustomerKey>de_custkey</CustomerKey>
            <Name>Data Extension Name</Name>
            <!-- Specify folder DE created in
            <CategoryID>432655</CategoryID>
            -->
            <IsSendable>true</IsSendable>
            <SendableDataExtensionField>
                <CustomerKey>SubscriberKey</CustomerKey>
                <Name>Subscriber Key</Name>
                <FieldType>Text</FieldType>
            </SendableDataExtensionField>
            <SendableSubscriberField>
                <Name>Subscriber Key</Name>
                <Value/>
            </SendableSubscriberField>
            <Fields>
                <Field>
                    <CustomerKey>SubscriberKey</CustomerKey>
                    <Name>Subscriber Key</Name>
                    <FieldType>Text</FieldType>
                    <MaxLength>50</MaxLength>
                    <IsRequired>true</IsRequired>
                    <IsPrimaryKey>true</IsPrimaryKey>
                </Field>
                <Field>
                    <CustomerKey>EmailAddress</CustomerKey>
                    <Name>Email Address</Name>
                    <FieldType>EmailAddress</FieldType>
                    <IsRequired>true</IsRequired>
                    <IsPrimaryKey>true</IsPrimaryKey>
                </Field>
                <Field>
                    <CustomerKey>FirstName</CustomerKey>
                    <Name>First Name</Name>
                    <FieldType>Text</FieldType>
                    <IsNillable>true</IsNillable>
                    <IsPrimaryKey>false</IsPrimaryKey>
                </Field>
                <Field>
                    <CustomerKey>SignupDate</CustomerKey>
                    <Name>Signup Date</Name>
                    <DataType>Date</DataType>
                    <IsNillable>true</IsNillable>
                    <IsPrimaryKey>false</IsPrimaryKey>
                    <FieldType>Date</FieldType>
                </Field> 
            </Fields>
         </Objects>
		</CreateRequest>
	</s:Body>
</s:Envelope>

@garek007
Copy link

It's been a while, but for retrieving, I think the main thing I used was to pass the MID in the auth call. That should work. (posted above)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants