FuelSDK-PHP icon indicating copy to clipboard operation
FuelSDK-PHP copied to clipboard

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

Open pentium10 opened this issue 4 years ago • 10 comments

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 avatar Jul 18 '19 15:07 pentium10

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

pentium10 avatar Jul 18 '19 15:07 pentium10

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.

garek007 avatar Dec 30 '22 02:12 garek007

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

pentium10 avatar Dec 30 '22 13:12 pentium10

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
    );

garek007 avatar Dec 30 '22 17:12 garek007

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 avatar Dec 30 '22 17:12 pentium10

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();

pentium10 avatar Dec 30 '22 17:12 pentium10

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.

garek007 avatar Dec 30 '22 17:12 garek007

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

  • filter() and sometimes
  • retrieveRequest()

pentium10 avatar Dec 30 '22 17:12 pentium10

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 avatar Dec 30 '22 17:12 garek007

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)

garek007 avatar Dec 30 '22 17:12 garek007