druid628 / exacttarget Goto Github PK
View Code? Open in Web Editor NEWExactTarget PHP Component for ExactTarget API
ExactTarget PHP Component for ExactTarget API
Hi there,
I'm running into a bit of an issue regarding DataExtensions again.
When I try to retrieve a DataExtensionObject with a specific filter, this library wants to find all properties of the object with the getDefinitionOfObject function ( https://github.com/druid628/exacttarget/blob/master/src/druid628/exactTarget/EtClient.php#L257 ) but ET doesn't return back an ObjectDefinition for DataExtensionObjects. So I get an error like "Undefined property: stdClass::$ObjectDefinition "
It is possible to get a list of properties available for the DataExtensionObject but we'd have to query for DataExtensionFields and filter based on CustomerKey ( http://salesforce.stackexchange.com/questions/22769/retrieving-all-column-names-from-a-dataextension ).
I tried to think of how this library could support retrieval of DataExtensionObjects and I came up with two options.
First is to create a new function on the EtClient that accepts a DataExtension CustomerKey and an array of filters. We could throw an exception when trying to retrieve a DataExtensionObject with recall() to alert the developer that that function is not supported for DEOs.
Second, is that we could move the getDefinitionofObjectRequest responsibility to the actual object classes. We'd have one base getDefinitionofObjectRequest and then extend it in each class that is necessary (which is just DEOs as of now). With this option, we'd either have to make that function a static function and then figure out how to pass in the CustomerKey for DEOs, or make it a regular function and then instantiate the class each time we need to get the ObjectDefinition.
I'd really like to use this library to retrieve DataExtensionObjects and I don't mind contributing code towards fixing this problem though I would like some guidance on how you'd prefer to structure the library around this change.
Thanks!
Also, getDefinitionofObjectRequest() is missing public, protected or private https://github.com/druid628/exacttarget/blob/master/src/druid628/exactTarget/EtClient.php#L257
The error is from here:
https://github.com/druid628/exacttarget/blob/master/src/druid628/exactTarget/EtClient.php#L252
It happens when I try to use the recall
method and the $properties
parameter is NULL
:
https://github.com/druid628/exacttarget/blob/master/src/druid628/exactTarget/EtClient.php#L208
There at least needs to be some kind of error-checking here. What am I doing wrong?
My code looks like this:
$sfp = new EtSimpleFilterPart();
$sfp->Property = "Name";
$sfp->SimpleOperator = EtSimpleOperators::EQUALS;
$sfp->Value = ['MyListName'];
$results = $this->client->recallSendDefinitionList($sfp);
If I add the $properties
array, the call works, but returns false:
$sfp = new EtSimpleFilterPart();
$sfp->Property = "Name";
$sfp->SimpleOperator = EtSimpleOperators::EQUALS;
$sfp->Value = ['MyListName'];
$results = $this->client->recallSendDefinitionList($sfp, ['Name']);
After the update from php 7.0 to 7.1. I get this error:
Function mcrypt_module_get_algo_key_size() is deprecated
ExactTargetClasses.php should be broken up and into individual files.
This creates an "issue" where the src/druid628/exactTarget/ directory will be then flooded with 200+ files. This is not a real issue it simply looks messy. Perhaps a restructure of classes is in order - this will require some code changes if restructuring and re-namespacing classes.
How can I get all subscribers of a list with filter ?
I haven't tested this out yet, and maybe I should have but it looks like if you pass in multiple filters, then this loop will overwrite the single filter object values.
https://github.com/druid628/exacttarget/blob/master/src/druid628/exactTarget/EtClient.php#L218
Am I missing something here or was that unintended?
Thanks :)
ExactTarget library will comply with PSR-1/2 Standards. There will be some specifications where the PSR's leave some elements optional.
In short:
Blocked by Issue #4
Insure that code matches coding standards.
Hello, I need send Triggered Email that depend on the subscriber if open previous email .
I already get the email address of subscriber.
How can I know if the subscriber opened my previous email ?
Thanks,.
https://github.com/druid628/exacttarget/blob/master/src/druid628/exactTarget/EtClient.php#L444
If an email fails to send for any reason, SendEmail returns false rather than a more useful reason why. This would be fine if the response/error was accessible another way but it isn't.
Either returning the response on failure or creating a getResponse() accessor would help here.
Hi , I want update attribute of subscribers.
$client = new EtClient($username,$password,'s7');
$subscriber = new EtSubscriber($client);
$subscriber->find($email);
$times = new EtAttribute('times',1);
$step = new EtAttribute('Step' ,'2');
$subscriber->updateAttribute($times);
$subscriber->updateAttribute($step);
//$subscriber->save();
$client->updateSubscriber($subscriber, 'updateOnly');
The code above got error:
SoapFault: Server was unable to read request. ---> There is an error in the XML document. ---> Instance validation error: '' is not a valid value for SaveAction.
So, May I know how can I save $subscriber after updating attribute ?
Thanks,
Add unit tests
Add documentation to both project in doc/ and to github wiki pages.
PHP 5.3 will reach EOL in July 2014.
As of June 30, 2014, the druid628/exacttarget library will no longer officially support PHP 5.3. A legacy branch and composer alias will be created for use with PHP 5.3 but will no longer be receiving regular updates. Please be making preparations now to convert to 5.4 or switch to legacy branch or composer alias.
Thanks for your understanding.
-DruiD628
I'm having trouble creating a DataExtensionObject. This is the code I'm using right now:
$result = $client->createDataExtensionObject(array(
'CustomerKey' => $data_extension_key,
'Properties' => $properties,
));
Where $properties is an array of EtAPIProperty objects.
In the PHP API Starter kit, and in this library, there are only two properties for EtDataExtensionObject (Name and Keys). When you look at the documentation (http://help.exacttarget.com/en/technical_library/web_service_guide/technical_articles/adding_data_to_data_extension_object/ ), and the sample create dataextensionobject in the php api starter kit, only a CustomerKey and array of Properties are used.
Now, I don't know much about SOAP or ET, but I looked in the WSDL and saw that the DataExtensionObject "extends" ObjectExtension, and that ObjectExtension has a Properties property. And the ObjectExtension extends an APIObject that has a CustomerKey.
The problem when using this library to send a Create request is that it only sets properties that are explicitly defined https://github.com/druid628/exacttarget/blob/master/src/druid628/exactTarget/EtClient.php#L157
One thing we could do is make EtObjectExtension extend ETApiObject, and then make ETDataExtension extend EtObjectExtension. I think I'm going to do this in a fork. Let me know if you want me to make a PR for it.
Here is the example on wiki:
/ instantiates the Client for SOAP Communications
$client = new EtClient($userName,$password);
$subscriberInfo = array(
array(
"Name" => "SubscriberKey",
"Value" => "[email protected]",
"operator" => "equals",
),
array(
"Name" => "EmailAddress",
"Value" => "[email protected]",
"operator" => "equals",
),
);
$subscriber = $client->recallSubscriber($subscriberInfo);
unfortunately, it's not working at all.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.