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

exposing retrieveRequest

Open pentium10 opened this issue 5 years ago • 1 comments

In order to work correctly with DataExtensions when it's being created on the parent account, you need to pass "ClientIDs" also at the Get calls as well.

<RetrieveRequestMsg xmlns="http://exacttarget.com/wsdl/partnerAPI">	    
	<RetrieveRequest> 
		<ClientIDs>	
			<ClientID>1234567</ClientID>
		</ClientIDs>

<!-- ...snippet end...-->

In order to make this possible, we

  • exposed retrieveRequest to be able to pull the data
  • modified post() to accept custom arrays

final working examples are like this:

create DataExtensions with custom ClientID

$postDRRow = new ET_DataExtension_Row();
$postDRRow->authStub = $this->soap_client;
$postDRRow->CustomerKey = $customerKey;
$objects = array(
    'Client' => array('ID' => $this->client_id),
);
foreach ($props as $key => $value) {
    $fields[] = array("Name" => $key, "Value" => $value);
}
$objects['CustomerKey'] = 'DataExtensionName';
$objects['Properties'] = array("Property" => $fields);

$res = $postDRRow->post($objects); /*<-- pass custom objects*/

and for retrieving custom DataExtensions

$getDERows = new ET_DataExtension_Row();
$getDERows->authStub = $this->soap_client;
$getDERows->retrieveRequest['ClientIDs'] = array('ID' => $this->client_id); /* <-- new exposed property*/
$getDERows->props = array(<edited attributes>'');
$getDERows->Name = $customerKey;
$getDERows->CustomerKey = $customerKey;

$res = $getDERows->get();

pentium10 avatar Jul 22 '19 16:07 pentium10

@manivinesh @sfdrogojan can you look into this?

pentium10 avatar Jul 23 '19 08:07 pentium10